sirepo.runner package

Submodules

sirepo.runner.background module

Run jobs as subprocesses

copyright:Copyright (c) 2016-2018 RadiaSoft LLC. All Rights Reserved.
license:http://www.apache.org/licenses/LICENSE-2.0.html
class sirepo.runner.background.BackgroundJob(*args, **kwargs)[source]

Bases: sirepo.runner.JobBase

Run as subprocess

sirepo.runner.background.init_class(app, uwsgi)[source]

sirepo.runner.celery module

Run jobs

copyright:Copyright (c) 2016-2018 RadiaSoft LLC. All Rights Reserved.
license:http://www.apache.org/licenses/LICENSE-2.0.html
class sirepo.runner.celery.CeleryJob(*args, **kwargs)[source]

Bases: sirepo.runner.JobBase

Run job in Celery (prod)

sirepo.runner.celery.init_class(app, uwsgi)[source]

Verify celery & rabbit are running

sirepo.runner.docker module

Run jobs in Docker

Locking is very tricky, because there are many long running operations. We try to release locks when possible when talking to docker daemons, for example.

Always grab Job.lock then _SlotManager.__lock, and try to avoid holding both locks.

copyright:Copyright (c) 2016-2018 RadiaSoft LLC. All Rights Reserved.
license:http://www.apache.org/licenses/LICENSE-2.0.html
class sirepo.runner.docker.DockerJob(*args, **kwargs)[source]

Bases: sirepo.runner.JobBase

Manage jobs running in containers

sirepo.runner.docker.init_class(app, uwsgi)[source]

Module contents

Run jobs

copyright:Copyright (c) 2016-2018 RadiaSoft LLC. All Rights Reserved.
license:http://www.apache.org/licenses/LICENSE-2.0.html
exception sirepo.runner.Collision[source]

Bases: exceptions.Exception

Avoid using a mutex

sirepo.runner.INIT_TOO_LONG_SECS = 5

how long to wait before assuming thread that created job is dead.

class sirepo.runner.JobBase(jid, data)[source]

Bases: object

Super of all job classes

is_processing()[source]
kill()[source]
run_secs()[source]
set_state(state)[source]
start()[source]
class sirepo.runner.State(*args, **kwds)[source]

Bases: aenum.UniqueEnum

INIT = <State.INIT: 1>
KILL = <State.KILL: 3>
RUN = <State.RUN: 4>
START = <State.START: 2>
STOP = <State.STOP: 5>
sirepo.runner.cfg = OrderedMapping(import_secs=10, job_class=None, parallel_secs=3600, sequential_secs=300)

Configuration

sirepo.runner.init(app, uwsgi, use_reloader)[source]

Initialize module

sirepo.runner.job_is_processing(jid)[source]
sirepo.runner.job_kill(jid)[source]

Terminate job

Parameters:jid (str) – see simulation_db.job_id
sirepo.runner.job_race_condition_reap(jid)[source]
sirepo.runner.job_start(data)[source]