aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorBonfaceKilz2021-02-16 20:25:54 +0300
committerBonfaceKilz2021-02-16 20:25:54 +0300
commit53d81e0d9f66f09b63e5b36bd33c79e8bc930215 (patch)
treecb7e3c42573a3332bb9b63b3351cc049f31e704b /gn3
parent9e638622d93cc405ecd14c3a5f4288e08aecdddb (diff)
downloadgenenetwork3-53d81e0d9f66f09b63e5b36bd33c79e8bc930215.tar.gz
Add extra option to set email when queueing CMD
The e-mail field will be used to send the results of the computation when it is completed.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/commands.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/gn3/commands.py b/gn3/commands.py
index e5a3b1e..7201a68 100644
--- a/gn3/commands.py
+++ b/gn3/commands.py
@@ -48,10 +48,10 @@ def compose_gemma_cmd(
return cmd
-def queue_cmd(cmd: str, conn: Redis) -> str:
- """Given a command CMD, and a redis connection CONN, queue it in Redis
-with an initial status of 'queued'. The following status codes are
-supported:
+def queue_cmd(conn: Redis, cmd: str, email: Optional[str] = None) -> str:
+ """Given a command CMD; (optional) EMAIL; and a redis connection CONN, queue
+it in Redis with an initial status of 'queued'. The following status codes
+are supported:
queued: Unprocessed; Still in the queue
running: Still running
@@ -70,6 +70,10 @@ supported:
conn.hset(key, value, unique_id)
conn.rpush("GN2::job-queue",
unique_id)
+ if email:
+ conn.hset("email",
+ email,
+ unique_id)
return unique_id