diff --git a/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/down.sql b/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/down.sql new file mode 100644 index 0000000000..5137af466c --- /dev/null +++ b/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/down.sql @@ -0,0 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE generic_inference_jobs DROP COLUMN is_keepalive_required; diff --git a/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/up.sql b/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/up.sql new file mode 100644 index 0000000000..a0c47493e0 --- /dev/null +++ b/_sql/migrations/2023-05-21-235956_alter_jobs_add_keepalive_flag/up.sql @@ -0,0 +1,7 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE generic_inference_jobs + ADD COLUMN is_keepalive_required BOOLEAN NOT NULL DEFAULT FALSE + AFTER priority_level; diff --git a/_sql/migrations_squashed/generic_inference_jobs.sql b/_sql/migrations_squashed/generic_inference_jobs.sql index d579e202d9..986ecb0e58 100644 --- a/_sql/migrations_squashed/generic_inference_jobs.sql +++ b/_sql/migrations_squashed/generic_inference_jobs.sql @@ -101,6 +101,13 @@ CREATE TABLE generic_inference_jobs ( -- - (There will be future levels for paid Twitch and social FakeYou rewards.) priority_level SMALLINT UNSIGNED NOT NULL DEFAULT 0, + -- For non-premium workloads (or some other workloads), we may require that the + -- user remains on the website. This will help us kill jobs if the user leaves. + -- The state for this keepalive signal will be job-type dependent and may live + -- in Redis or some other system. Typically the frontend job status polling will + -- populate this keepalive signal (eg. in a Redis key with TTL). + is_keepalive_required BOOLEAN NOT NULL DEFAULT FALSE, + -- TODO: add is_for_storyteller_product is_from_premium_user BOOLEAN NOT NULL DEFAULT FALSE, is_from_api_user BOOLEAN NOT NULL DEFAULT FALSE,