From ef241fe4e3764de30795092b7dbc3ecc3fcafe50 Mon Sep 17 00:00:00 2001 From: Alfred Gedeon Date: Wed, 22 Nov 2023 16:25:03 -0800 Subject: [PATCH] fix warning and test launching --- .github/workflows/ci_run_jobs_cfg.json | 4 ++ samples/jobs/describe_job_execution/main.cpp | 39 +++++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_run_jobs_cfg.json b/.github/workflows/ci_run_jobs_cfg.json index ca0bec8f7..1a28f96e6 100644 --- a/.github/workflows/ci_run_jobs_cfg.json +++ b/.github/workflows/ci_run_jobs_cfg.json @@ -25,6 +25,10 @@ { "name": "--job_id", "data": "CI_Jobs_Thing_Job_1" + }, + { + "name": "--is_ci", + "data": "true" } ] } diff --git a/samples/jobs/describe_job_execution/main.cpp b/samples/jobs/describe_job_execution/main.cpp index d9086adea..546d6d1d1 100644 --- a/samples/jobs/describe_job_execution/main.cpp +++ b/samples/jobs/describe_job_execution/main.cpp @@ -142,10 +142,13 @@ int main(int argc, char *argv[]) fprintf(stderr, "Error %d occurred\n", ioErr); return; } - fprintf(stdout, "Received Job:\n"); - fprintf(stdout, "Job Id: %s\n", response->Execution->JobId->c_str()); - fprintf(stdout, "ClientToken: %s\n", response->ClientToken->c_str()); - fprintf(stdout, "Execution Status: %s\n", JobStatusMarshaller::ToString(*response->Execution->Status)); + if (response) + { + fprintf(stdout, "Received Job:\n"); + fprintf(stdout, "Job Id: %s\n", response->Execution->JobId->c_str()); + fprintf(stdout, "ClientToken: %s\n", response->ClientToken->c_str()); + fprintf(stdout, "Execution Status: %s\n", JobStatusMarshaller::ToString(*response->Execution->Status)); + } }; jobsClient.SubscribeToDescribeJobExecutionAccepted( @@ -206,11 +209,17 @@ int main(int argc, char *argv[]) { auto OnSubscribeToStartNextPendingJobExecutionAcceptedResponse = [&](StartNextJobExecutionResponse *response, int ioErr) { - fprintf(stdout, "Start Job %s\n", response->Execution.value().JobId.value().c_str()); - currentJobId = response->Execution->JobId.value(); - currentExecutionNumber = response->Execution->ExecutionNumber.value(); - currentVersionNumber = response->Execution->VersionNumber.value(); - + if (ioErr) + { + fprintf(stderr, "Error %d occurred\n", ioErr); + } + if (response) + { + fprintf(stdout, "Start Job %s\n", response->Execution.value().JobId.value().c_str()); + currentJobId = response->Execution->JobId.value(); + currentExecutionNumber = response->Execution->ExecutionNumber.value(); + currentVersionNumber = response->Execution->VersionNumber.value(); + } pendingExecutionPromise.set_value(); }; @@ -245,7 +254,12 @@ int main(int argc, char *argv[]) { pendingExecutionPromise = std::promise(); auto OnSubscribeToUpdateJobExecutionAcceptedResponse = [&](UpdateJobExecutionResponse *response, - int iotErr) { + int ioErr) { + (void)response; + if (ioErr) + { + fprintf(stderr, "Error %d occurred\n", ioErr); + } fprintf(stdout, "Marked Job %s IN_PROGRESS", currentJobId.c_str()); pendingExecutionPromise.set_value(); }; @@ -288,6 +302,11 @@ int main(int argc, char *argv[]) subscriptionRequest.JobId = currentJobId; auto subscribeHandler = [&](UpdateJobExecutionResponse *response, int ioErr) { + (void)response; + if (ioErr) + { + fprintf(stderr, "Error %d occurred\n", ioErr); + } fprintf(stdout, "Marked job %s currentJobId SUCCEEDED", currentJobId.c_str()); pendingExecutionPromise.set_value(); };