From d09d27a04ce61eab0a9322a1295fe74aea6fc635 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 17 Feb 2022 08:56:37 +0100 Subject: [PATCH] Add and correct job states --- init-db.go | 2 +- schema/job.go | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/init-db.go b/init-db.go index 5c32243..f53ae05 100644 --- a/init-db.go +++ b/init-db.go @@ -31,7 +31,7 @@ const JOBS_DB_SCHEMA string = ` ` + "`partition`" + ` VARCHAR(255) NOT NULL, -- partition is a keyword in mysql -.- array_job_id BIGINT NOT NULL, duration INT, - job_state VARCHAR(255) NOT NULL CHECK(job_state IN ('running', 'completed', 'failed', 'canceled', 'stopped', 'timeout')), + job_state VARCHAR(255) NOT NULL CHECK(job_state IN ('running', 'completed', 'failed', 'cancelled', 'stopped', 'timeout', 'preempted', 'out_of_memory')), meta_data TEXT, -- JSON resources TEXT NOT NULL, -- JSON diff --git a/schema/job.go b/schema/job.go index 37b4fc2..1115b8e 100644 --- a/schema/job.go +++ b/schema/job.go @@ -123,12 +123,14 @@ type Resource struct { type JobState string const ( - JobStateRunning JobState = "running" - JobStateCompleted JobState = "completed" - JobStateFailed JobState = "failed" - JobStateCanceled JobState = "canceled" - JobStateStopped JobState = "stopped" - JobStateTimeout JobState = "timeout" + JobStateRunning JobState = "running" + JobStateCompleted JobState = "completed" + JobStateFailed JobState = "failed" + JobStateCancelled JobState = "cancelled" + JobStateStopped JobState = "stopped" + JobStateTimeout JobState = "timeout" + JobStatePreempted JobState = "preempted" + JobStateOutOfMemory JobState = "out_of_memory" ) func (e *JobState) UnmarshalGQL(v interface{}) error { @@ -153,7 +155,7 @@ func (e JobState) Valid() bool { return e == JobStateRunning || e == JobStateCompleted || e == JobStateFailed || - e == JobStateCanceled || + e == JobStateCancelled || e == JobStateStopped || e == JobStateTimeout }