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

🐛 [Job] Device target status incorrect when re-executing a failed step. #4211

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ public void beforeJob() throws Exception {
jobLogger.error(e, "Resetting {} targets to step index: {}... ERROR!", jobExecution.getTargetIds().size(), resetToStepIndex);
}
jobLogger.info("Resetting {} targets to step index: {}... DONE!", jobExecution.getTargetIds().size(), resetToStepIndex);
} else {
for (KapuaId jobTargetId : jobExecution.getTargetIds()) {
JobTarget jobTarget = KapuaSecurityUtils.doPrivileged(() -> jobTargetService.find(jobExecution.getScopeId(), jobTargetId));
if (jobTarget.getStatus().equals(JobTargetStatus.PROCESS_FAILED)) {
jobTarget.setStatus(JobTargetStatus.PROCESS_AWAITING);
jobTarget.setStatusMessage(null);
jobTarget.setException(null);
KapuaSecurityUtils.doPrivileged(() -> jobTargetService.update(jobTarget));
}
}
}

jobLogger.info("Running before job... DONE!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,34 @@ Feature: Job Engine Service - Operations
Then I confirm that job has 2 job execution
And I confirm that job target in job has step index 0 and status "PROCESS_OK"

Scenario: Start - JobTarget failed, then "loading status" (process_awaiting), then ok

Given I login as user with name "kapua-sys" and password "kapua-password"
And I create a device with name "rpione3"
And I create a job with the name "TestJob"
And I add device targets to job
| rpione3 |
And I search for step definition with the name
| Command Execution |
And I add job step to job with name "Test Step - Command Exec" and with selected job step definition and properties
| name | type | value |
| commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | <?xml version="1.0" encoding="UTF-8"?><commandInput><command>ping</command><arguments><argument>-c</argument><argument>10</argument><argument>8.8.8.8</argument></arguments><timeout>30000</timeout><runAsynch>false</runAsynch></commandInput> |
| timeout | java.lang.Long | 30000 |
When I start a job
#Now I await some time in order to synch job-engine and the service used to read job executions...
And I wait job to finish its execution up to 15s
Then I confirm that job has 1 job execution
And I confirm that job target in job has step index 0 and status "PROCESS_FAILED"
Then I start the Kura Mock
And Device birth message is sent
And Device "rpione3" is connected within 10s
When I start a job
And I wait for another job start up to 2s
Then I confirm that job has 2 job execution
And I confirm that job target in job has step index 0 and status "PROCESS_AWAITING"
And I wait job to finish its execution up to 15s
And I confirm that job target in job has step index 0 and status "PROCESS_OK"

Scenario: Start - Two JobSteps

Given I login as user with name "kapua-sys" and password "kapua-password"
Expand Down
Loading