Exemple #1
0
from openquake.job.handlers import resolve_handler
from openquake.job import config as conf
from openquake.job import params as job_params
from openquake.job.mixins import Mixin
from openquake.job.params import (
    PARAMS, CALCULATION_MODE, ENUM_MAP, PATH_PARAMS, INPUT_FILE_TYPES,
    ARRAY_RE)
from openquake.kvs import mark_job_as_current
from openquake.logs import LOG
from openquake.utils import stats

RE_INCLUDE = re.compile(r'^(.*)_INCLUDE')

FLAGS = flags.FLAGS

REVERSE_ENUM_MAP = dict((v, k) for k, v in ENUM_MAP.iteritems())


def run_job(job_file, output_type):
    """
    Given a job_file, run the job.

    :param job_file: the path of the configuration file for the job
    :type job_file: string
    :param output_type: the desired format for the results, one of 'db', 'xml'
    :type output_type: string
    """
    a_job = Job.from_file(job_file, output_type)
    a_job.set_status('running')

    # closing all db connections to make sure they're not shared between