Esempio n. 1
0
def create_job(name,
               priority,
               control_file,
               control_type,
               hosts=[],
               profiles=[],
               meta_hosts=[],
               meta_host_profiles=[],
               one_time_hosts=[],
               atomic_group_name=None,
               synch_count=None,
               is_template=False,
               timeout=None,
               max_runtime_hrs=None,
               run_verify=True,
               email_list='',
               dependencies=(),
               reboot_before=None,
               reboot_after=None,
               parse_failed_repair=None,
               hostless=False,
               keyvals=None,
               drone_set=None):
    """\
    Create and enqueue a job.

    @param name name of this job
    @param priority Low, Medium, High, Urgent
    @param control_file String contents of the control file.
    @param control_type Type of control file, Client or Server.
    @param synch_count How many machines the job uses per autoserv execution.
    synch_count == 1 means the job is asynchronous.  If an atomic group is
    given this value is treated as a minimum.
    @param is_template If true then create a template job.
    @param timeout Hours after this call returns until the job times out.
    @param max_runtime_hrs Hours from job starting time until job times out
    @param run_verify Should the host be verified before running the test?
    @param email_list String containing emails to mail when the job is done
    @param dependencies List of label names on which this job depends
    @param reboot_before Never, If dirty, or Always
    @param reboot_after Never, If all tests passed, or Always
    @param parse_failed_repair if true, results of failed repairs launched by
    this job will be parsed as part of the job.
    @param hostless if true, create a hostless job
    @param keyvals dict of keyvals to associate with the job

    @param hosts List of hosts to run job on.
    @param profiles List of profiles to use, in sync with @hosts list
    @param meta_hosts List where each entry is a label name, and for each entry
    one host will be chosen from that label to run the job on.
    @param one_time_hosts List of hosts not in the database to run the job on.
    @param atomic_group_name The name of an atomic group to schedule the job on.
    @param drone_set The name of the drone set to run this test on.


    @returns The created Job id number.
    """
    return rpc_utils.create_job_common(
        **rpc_utils.get_create_job_common_args(locals()))
Esempio n. 2
0
def create_job(name, priority, control_file, control_type,
               hosts=[], profiles=[], meta_hosts=[], meta_host_profiles=[],
               one_time_hosts=[], atomic_group_name=None, synch_count=None,
               is_template=False, timeout=None, max_runtime_hrs=None,
               run_verify=True, email_list='', dependencies=(), reboot_before=None,
               reboot_after=None, parse_failed_repair=None, hostless=False,
               keyvals=None, drone_set=None, reserve_hosts=False):
    """
    Create and enqueue a job.

    :param name: name of this job
    :param priority: Low, Medium, High, Urgent
    :param control_file: String contents of the control file.
    :param control_type: Type of control file, Client or Server.
    :param synch_count: How many machines the job uses per autoserv execution.
                        synch_count == 1 means the job is asynchronous. If an
                        atomic group is given this value is treated as a
                        minimum.
    :param is_template: If true then create a template job.
    :param timeout: Hours after this call returns until the job times out.
    :param max_runtime_hrs: Hours from job starting time until job times out
    :param run_verify: Should the host be verified before running the test?
    :param email_list: String containing emails to mail when the job is done
    :param dependencies: List of label names on which this job depends
    :param reboot_before: Never, If dirty, or Always
    :param reboot_after: Never, If all tests passed, or Always
    :param parse_failed_repair: if true, results of failed repairs launched by
                                this job will be parsed as part of the job.
    :param hostless: if true, create a hostless job
    :param keyvals: dict of keyvals to associate with the job
    :param hosts: List of hosts to run job on.
    :param profiles: List of profiles to use, in sync with @hosts list
    :param meta_hosts: List where each entry is a label name, and for each
                       entry one host will be chosen from that label to run
                       the job on.
    :param one_time_hosts: List of hosts not in the database to run the job on.
    :param atomic_group_name: name of an atomic group to schedule the job on.
    :param drone_set: The name of the drone set to run this test on.
    :param reserve_hosts: If set we will reseve the hosts that were allocated
                          for this job
    :returns: The created Job id number.
    :rtype: integer
    """
    return rpc_utils.create_job_common(
        **rpc_utils.get_create_job_common_args(locals()))
Esempio n. 3
0
def create_parameterized_job(name, priority, test, parameters, kernel=None,
                             label=None, profiles=[], profilers=(),
                             profiler_parameters=None,
                             use_container=False, profile_only=None,
                             upload_kernel_config=False, hosts=[],
                             meta_hosts=[], meta_host_profiles=[], one_time_hosts=[],
                             atomic_group_name=None, synch_count=None,
                             is_template=False, timeout=None,
                             max_runtime_hrs=None, run_verify=True,
                             email_list='', dependencies=(), reboot_before=None,
                             reboot_after=None, parse_failed_repair=None,
                             hostless=False, keyvals=None, drone_set=None,
                             reserve_hosts=False):
    """
    Creates and enqueues a parameterized job.

    Most parameters a combination of the parameters for generate_control_file()
    and create_job(), with the exception of:

    :param test name or ID of the test to run
    :param parameters a map of parameter name ->
                          tuple of (param value, param type)
    :param profiler_parameters a dictionary of parameters for the profilers:
                                   key: profiler name
                                   value: dict of param name -> tuple of
                                                                (param value,
                                                                 param type)
    """
    # Save the values of the passed arguments here. What we're going to do with
    # them is pass them all to rpc_utils.get_create_job_common_args(), which
    # will extract the subset of these arguments that apply for
    # rpc_utils.create_job_common(), which we then pass in to that function.
    args = locals()

    # Set up the parameterized job configs
    test_obj = models.Test.smart_get(test)
    if test_obj.test_type == model_attributes.TestTypes.SERVER:
        control_type = models.Job.ControlType.SERVER
    else:
        control_type = models.Job.ControlType.CLIENT

    try:
        label = models.Label.smart_get(label)
    except models.Label.DoesNotExist:
        label = None

    kernel_objs = models.Kernel.create_kernels(kernel)
    profiler_objs = [models.Profiler.smart_get(profiler)
                     for profiler in profilers]

    parameterized_job = models.ParameterizedJob.objects.create(
        test=test_obj, label=label, use_container=use_container,
        profile_only=profile_only,
        upload_kernel_config=upload_kernel_config)
    parameterized_job.kernels.add(*kernel_objs)

    for profiler in profiler_objs:
        parameterized_profiler = models.ParameterizedJobProfiler.objects.create(
            parameterized_job=parameterized_job,
            profiler=profiler)
        profiler_params = profiler_parameters.get(profiler.name, {})
        for name, (value, param_type) in profiler_params.iteritems():
            models.ParameterizedJobProfilerParameter.objects.create(
                parameterized_job_profiler=parameterized_profiler,
                parameter_name=name,
                parameter_value=value,
                parameter_type=param_type)

    try:
        for parameter in test_obj.testparameter_set.all():
            if parameter.name in parameters:
                param_value, param_type = parameters.pop(parameter.name)
                parameterized_job.parameterizedjobparameter_set.create(
                    test_parameter=parameter, parameter_value=param_value,
                    parameter_type=param_type)

        if parameters:
            raise Exception('Extra parameters remain: %r' % parameters)

        return rpc_utils.create_job_common(
            parameterized_job=parameterized_job.id,
            control_type=control_type,
            **rpc_utils.get_create_job_common_args(args))
    except:
        parameterized_job.delete()
        raise
Esempio n. 4
0
def create_parameterized_job(name,
                             priority,
                             test,
                             parameters,
                             kernel=None,
                             label=None,
                             profiles=[],
                             profilers=(),
                             profiler_parameters=None,
                             use_container=False,
                             profile_only=None,
                             upload_kernel_config=False,
                             hosts=[],
                             meta_hosts=[],
                             meta_host_profiles=[],
                             one_time_hosts=[],
                             atomic_group_name=None,
                             synch_count=None,
                             is_template=False,
                             timeout=None,
                             max_runtime_hrs=None,
                             run_verify=True,
                             email_list='',
                             dependencies=(),
                             reboot_before=None,
                             reboot_after=None,
                             parse_failed_repair=None,
                             hostless=False,
                             keyvals=None,
                             drone_set=None,
                             reserve_hosts=False):
    """
    Creates and enqueues a parameterized job.

    Most parameters a combination of the parameters for generate_control_file()
    and create_job(), with the exception of:

    :param test name or ID of the test to run
    :param parameters a map of parameter name ->
                          tuple of (param value, param type)
    :param profiler_parameters a dictionary of parameters for the profilers:
                                   key: profiler name
                                   value: dict of param name -> tuple of
                                                                (param value,
                                                                 param type)
    """
    # Save the values of the passed arguments here. What we're going to do with
    # them is pass them all to rpc_utils.get_create_job_common_args(), which
    # will extract the subset of these arguments that apply for
    # rpc_utils.create_job_common(), which we then pass in to that function.
    args = locals()

    # Set up the parameterized job configs
    test_obj = models.Test.smart_get(test)
    if test_obj.test_type == model_attributes.TestTypes.SERVER:
        control_type = models.Job.ControlType.SERVER
    else:
        control_type = models.Job.ControlType.CLIENT

    try:
        label = models.Label.smart_get(label)
    except models.Label.DoesNotExist:
        label = None

    kernel_objs = models.Kernel.create_kernels(kernel)
    profiler_objs = [
        models.Profiler.smart_get(profiler) for profiler in profilers
    ]

    parameterized_job = models.ParameterizedJob.objects.create(
        test=test_obj,
        label=label,
        use_container=use_container,
        profile_only=profile_only,
        upload_kernel_config=upload_kernel_config)
    parameterized_job.kernels.add(*kernel_objs)

    for profiler in profiler_objs:
        parameterized_profiler = models.ParameterizedJobProfiler.objects.create(
            parameterized_job=parameterized_job, profiler=profiler)
        profiler_params = profiler_parameters.get(profiler.name, {})
        for name, (value, param_type) in profiler_params.iteritems():
            models.ParameterizedJobProfilerParameter.objects.create(
                parameterized_job_profiler=parameterized_profiler,
                parameter_name=name,
                parameter_value=value,
                parameter_type=param_type)

    try:
        for parameter in test_obj.testparameter_set.all():
            if parameter.name in parameters:
                param_value, param_type = parameters.pop(parameter.name)
                parameterized_job.parameterizedjobparameter_set.create(
                    test_parameter=parameter,
                    parameter_value=param_value,
                    parameter_type=param_type)

        if parameters:
            raise Exception('Extra parameters remain: %r' % parameters)

        return rpc_utils.create_job_common(
            parameterized_job=parameterized_job.id,
            control_type=control_type,
            **rpc_utils.get_create_job_common_args(args))
    except:
        parameterized_job.delete()
        raise