Commit b292f185 authored by David Mendez's avatar David Mendez
Browse files

Status daemon: move launcher function to a separate module

parent ce73b471
......@@ -23,6 +23,7 @@ from app.config import RUN_CONFIG
from app.models import delayed_job_models
from app import utils
from app.job_statistics import statistics_saver
from app.job_status_daemon import meeseeks_launcher
JOBS_RUN_DIR = RUN_CONFIG.get('jobs_run_dir', str(Path().absolute()) + '/jobs_run')
if not os.path.isabs(JOBS_RUN_DIR):
......@@ -562,15 +563,7 @@ def submit_job_to_lsf(job):
delayed_job_models.save_job(job)
app_logging.debug(f'LSF Job ID is: {lsf_job_id}')
app_logging.debug('Going to launch Mr Meeseeks to monitor the job status')
meeseeks_command = f'/app/run_daemon.sh {job.id}'
app_logging.debug(f'Mr Meeseeks command is: {meeseeks_command}')
checker_env = {
'CONFIG_FILE_PATH':os.getenv('CONFIG_FILE_PATH')
}
app_logging.debug(f'Mr Meeseeks env is: {checker_env}')
meeseeks_process = subprocess.Popen(shlex.split(meeseeks_command), env=checker_env)
app_logging.debug(f'Mr Meeseeks summoned! PID is {meeseeks_process.pid}')
meeseeks_launcher.summon_meeseeks_for_job(job.id)
def get_lsf_job_id(submission_out):
......
"""
Module that launches the status daemon in a Mr Meeseeks way
"""
import os
import shlex
import subprocess
import app.app_logging as app_logging
def summon_meeseeks_for_job(job_id):
"""
starts the job checking process. It will disappear once the job is finished or errored.
:param job_id: id of the job to monitor
"""
app_logging.debug('Going to launch Mr Meeseeks to monitor the job status')
meeseeks_command = f'/app/run_daemon.sh {job_id}'
app_logging.debug(f'Mr Meeseeks command is: {meeseeks_command}')
checker_env = {
'CONFIG_FILE_PATH': os.getenv('CONFIG_FILE_PATH')
}
app_logging.debug(f'Mr Meeseeks env is: {checker_env}')
meeseeks_process = subprocess.Popen(shlex.split(meeseeks_command), env=checker_env)
app_logging.debug(f'Mr Meeseeks summoned! PID is {meeseeks_process.pid}')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment