Exemplo n.º 1
0
def experiment_pre_save(sender, **kwargs):
    instance = kwargs['instance']
    # Check if declarations need to be set
    if not instance.declarations and instance.specification:
        instance.declarations = instance.specification.declarations
    set_tags(instance=instance)
    set_persistence(instance=instance)
    set_outputs(instance=instance)
    set_outputs_refs(instance=instance)
    set_name(instance=instance, query=Experiment.all)
    set_backend(instance=instance, default_backend=ExperimentBackend.NATIVE)
    set_framework(instance=instance)
    if not instance.specification or not instance.specification.build:
        return

    if instance.is_independent:
        assign_code_reference(instance)
    else:
        instance.code_reference = instance.experiment_group.code_reference
Exemplo n.º 2
0
def job_pre_save(sender, **kwargs):
    instance = kwargs['instance']
    set_tags(instance=instance)
    set_persistence(instance=instance)
    set_outputs(instance=instance)
    set_outputs_refs(instance=instance)

    # Add code reference
    # Check if :
    # the job is new
    # that it has an build section
    # that is not an external repo (because we did not clone it yet)
    # if the instance has a primary key then is getting updated
    condition = (instance.specification.build.git or instance.code_reference
                 or not instance.project.has_code)
    if condition:
        return

    assign_code_reference(instance)
Exemplo n.º 3
0
def experiment_group_pre_save(sender, **kwargs):
    instance = kwargs['instance']
    # Add code reference
    assign_code_reference(instance)
    # Check if params need to be set
    if not instance.hptuning and instance.specification:
        hptuning_config = instance.specification.hptuning
        hptuning = hptuning_config.to_dict()
        if hptuning_config.search_algorithm == SearchAlgorithms.GRID:
            hptuning['grid_search'] = hptuning.get('grid_search', {})
        instance.hptuning = hptuning
    set_tags(instance=instance)
    set_persistence(instance=instance)
    # Set type
    if not instance.hptuning:
        instance.group_type = GroupTypes.SELECTION
    else:
        instance.group_type = GroupTypes.STUDY
    set_name(instance=instance, query=ExperimentGroup.all)