Commit 25773229 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

fix: Fixed callbacks being triggered twice

parent 7e87ca51
Pipeline #2362 passed with stage
in 6 seconds
......@@ -96,16 +96,12 @@ class SlurmConnector implements ClusterInterface
$collection->each(function ($job) {
$clusterJob = JobModel::findOrFail($job['id']);
event(new JobQueued($clusterJob, $job['queued_at']));
$jobClass = $clusterJob->job;
if ($job['event'] === 'completed_at') {
event(new JobCompleted($clusterJob, $job['datetime']));
$jobClass->onSuccess($clusterJob);
} elseif ($job['event'] === 'failed_at') {
event(new JobFailed($clusterJob, $job['datetime']));
$jobClass->onFailure($clusterJob);
} elseif ($job['event'] === 'cancelled_at') {
event(new JobCancelled($clusterJob, $job['datetime']));
$jobClass->onCancel($clusterJob);
}
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment