Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import sirepo.mpi
import sirepo.srdb
import subprocess
import sys
import threading
import time
#: Configuration
cfg = None
# Map of jid to instance
_job_map = pkcollections.Dict()
_job_map_lock = threading.RLock()
class State(aenum.UniqueEnum):
INIT = 1
START = 2
KILL = 3
RUN = 4
STOP = 5
_JOB_CLASSES = ('background', 'celery', 'docker', 'container')
_JOB_CLASS_DEFAULT = _JOB_CLASSES[0]
#: how long to wait before assuming thread that created job is dead.
INIT_TOO_LONG_SECS = 5
# how long to wait after first kill (TERM) to second kill (KILL)
KILL_TIMEOUT_SECS = 3
import subprocess
import sys
import threading
import time
import uuid
#: Configuration
cfg = None
# Map of jid to instance
_job_map = pkcollections.Dict()
_job_map_lock = threading.RLock()
class State(aenum.UniqueEnum):
INIT = 1
START = 2
KILL = 3
RUN = 4
STOP = 5
# how long to wait before assuming thread that created
# job is dead.
_INIT_TOO_LONG_SECS = 5
# time expected between created and running
_DOCKER_CREATED_TOO_LONG_SECS = _INIT_TOO_LONG_SECS
# how long to wait after first kill (TERM) to second kill (KILL)
_KILL_TIMEOUT_SECS = 3