Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth jwt added to error message pipeline fail #180

Merged
merged 26 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
67af23c
auth jwt added to error message pipeline fail
StefanBabukov Oct 13, 2021
afe3bb1
Merge branch 'master' into add-authjwt
StefanBabukov Oct 19, 2021
20ea4b9
add input to gem2s message too
StefanBabukov Oct 20, 2021
e0572a9
Merge branch 'add-authjwt' of https://github.com/biomage-ltd/pipeline…
StefanBabukov Oct 20, 2021
b61eb5a
Merge branch 'master' into add-authjwt
StefanBabukov Oct 22, 2021
790bed7
Merge branch 'master' into add-authjwt
StefanBabukov Oct 22, 2021
7eaf32d
Merge branch 'add-authjwt' of https://github.com/biomage-ltd/pipeline…
StefanBabukov Oct 22, 2021
09ff91f
test failing
StefanBabukov Oct 24, 2021
2ec8606
add removed lines for test coverage
StefanBabukov Oct 26, 2021
211fe82
revert modified files
StefanBabukov Oct 26, 2021
7cf228e
forgotten file
StefanBabukov Oct 26, 2021
fcaaa0d
init testing
alexvpickering Oct 27, 2021
42d5330
Merge branch 'add-authjwt' of github.com:biomage-ltd/pipeline into ad…
alexvpickering Oct 27, 2021
13f1a1f
test
StefanBabukov Oct 27, 2021
8f6a90e
init mockery stub
alexvpickering Oct 27, 2021
d02d66a
remove Rcheck logs
alexvpickering Oct 27, 2021
d21b026
add mockery to lockfile
alexvpickering Oct 27, 2021
c0d6452
comment fixes
StefanBabukov Oct 30, 2021
d2ea494
test crash and merge conflicts
StefanBabukov Nov 9, 2021
7094593
well i cant crash test because tests fail :/
StefanBabukov Nov 9, 2021
47991ad
test fail
StefanBabukov Nov 9, 2021
212d5a6
commit without exporter roles
StefanBabukov Nov 10, 2021
f21859d
trying to test fail again
StefanBabukov Nov 10, 2021
4ab6158
change fail
StefanBabukov Nov 11, 2021
75bbbfc
added taskName to fail pipeline message
kafkasl Nov 11, 2021
8a79b1d
remove stopping
StefanBabukov Nov 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions chart-infra/templates/kubernetes-event-exporter-roles.yaml

This file was deleted.

18 changes: 12 additions & 6 deletions pipeline-runner/R/handle_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ send_output_to_api <- function(pipeline_config, input, plot_data_keys, output) {
return(result$MessageId)
}

send_gem2s_update_to_api <- function(pipeline_config, experiment_id, task_name, data, auth_JWT) {
send_gem2s_update_to_api <- function(pipeline_config, experiment_id, task_name, data, input) {
message("Sending to SNS topic ", pipeline_config$sns_topic)
sns <- paws::sns(config = pipeline_config$aws_config)

msg <- c(data, taskName = list(task_name), experimentId = list(experiment_id), authJWT = list(auth_JWT))
# TODO -REMOVE DUPLICATE AUTHJWT IN RESPONSE
msg <- c(data, taskName = list(task_name), experimentId = list(experiment_id), authJWT = list(input$auth_JWT), input = list(input))

result <- sns$publish(
Message = RJSONIO::toJSON(msg),
Expand All @@ -124,11 +124,17 @@ send_gem2s_update_to_api <- function(pipeline_config, experiment_id, task_name,
return(result$MessageId)
}

send_pipeline_fail_update <- function(pipeline_config, experiment_id, process_name, error_message) {
send_pipeline_fail_update <- function(pipeline_config, input, error_message) {
process_name <- input$processName

error_msg <- list()
error_msg$experimentId <- experiment_id
error_msg$response$error <- error_message

# TODO - REMOVE THE DUPLICATE EXPERIMETN ID FROM INPUT RESPONSE

error_msg$experimentId <- input$experimentId
error_msg$taskName <- input$taskName
error_msg$response$error <- process_name
error_msg$input <- input
sns <- paws::sns(config = pipeline_config$aws_config)

string_value <- ""
Expand Down
1 change: 0 additions & 1 deletion pipeline-runner/R/qc-5-filter_doublets.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ filter_doublets <- function(scdata, config, sample_id, cells_id, task_name = "do
config = config,
plotData = guidata
)

return(result)
}

Expand Down
4 changes: 2 additions & 2 deletions pipeline-runner/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ call_gem2s <- function(task_name, input, pipeline_config) {
c(data, task_out) %<-% run_gem2s_step(task_name, input, pipeline_config, prev_out)
assign("prev_out", task_out, pos = ".GlobalEnv")

message_id <- send_gem2s_update_to_api(pipeline_config, experiment_id, task_name, data, input$authJWT)
message_id <- send_gem2s_update_to_api(pipeline_config, experiment_id, task_name, data, input)

return(message_id)
}
Expand Down Expand Up @@ -358,7 +358,7 @@ init <- function() {
cause = error_txt
)

send_pipeline_fail_update(pipeline_config, input_parse$experimentId, input_parse$processName, error_txt)
send_pipeline_fail_update(pipeline_config, input_parse, error_txt)

message("Sent task failure to state machine task: ", taskToken)
message("recovered from error:", e$message)
Expand Down
7 changes: 7 additions & 0 deletions pipeline-runner/renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,13 @@
"Repository": "CRAN",
"Hash": "fec5f52652d60615fdb3957b3d74324a"
},
"mockery": {
"Package": "mockery",
"Version": "0.4.2",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "313fa6504824ba5aab9308412135fb5f"
},
"munsell": {
"Package": "munsell",
"Version": "0.5.0",
Expand Down
26 changes: 26 additions & 0 deletions pipeline-runner/tests/testthat/test-handle_data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

mock_sns <- function(config) {
return(
list(publish = function (Message, TopicArn, MessageAttributes) {
return (list(MessageId = 'ok'))
}
))
}

test_that("send_gem2s_update_to_api completes successfully", {
pipeline_config <- list(
sns_topic = 'ExampleTopic',
aws_config = NULL
)

mockery::stub(send_gem2s_update_to_api, 'paws::sns', mock_sns)

response <- send_gem2s_update_to_api(pipeline_config,
experiment_id = 'dfgdfg',
task_name = 'dsfdsdf',
data = 1:5,
input = list(auth_JWT='ayylmao'))


expect_true(response == 'ok')
})