Commit 7f9270d4 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

fix: Trying to fix some update issue

parent d59df049
Pipeline #2352 passed with stage
in 6 seconds
......@@ -11,6 +11,7 @@ use Dterumal\LaravelCluster\Events\JobFailed;
use Dterumal\LaravelCluster\Storage\JobModel;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
......@@ -61,6 +62,7 @@ class SlurmConnector implements ClusterInterface
public function mapEvents(Collection $collection)
{
return $collection->map(function ($job) {
Log::info('Job STATE on refresh is ' . $job['state']);
switch ($job['state']) {
case 'COMPLETED':
$event = 'completed_at';
......@@ -105,6 +107,7 @@ class SlurmConnector implements ClusterInterface
event(new JobCancelled($clusterJob, $job['datetime']));
$jobClass->onCancel($clusterJob);
}
$clusterJob->update(Arr::except($job, ['event']));
});
}
......@@ -243,9 +246,9 @@ EOF",
$sudoUser = config('laravel-cluster.connections.slurm.sudo_account');
if(!is_null($sudoUser)) {
$process = Process::fromShellCommandline("sudo -u $sudoUser sbatch --parsable $payload");
$process = Process::fromShellCommandline("sudo -u $sudoUser --chdir=/tmp sbatch --parsable $payload");
} else {
$process = Process::fromShellCommandline("sbatch --parsable $payload");
$process = Process::fromShellCommandline("sbatch --chdir=/tmp --parsable $payload");
}
$process->run();
......
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