Ejemplo n.º 1
0
def create_evaluation(project, workflow, evaluation=None):
    """The basic method for creating an evaluation (evaluating a workflow).
    """
    output_dictionary = {}
    database = project
    if type(database) in [dict, OrderedDict]:
        database = database['database']
    if type(workflow) not in [dict, OrderedDict]:
        workflow = workflow_processor.get_workflow(database, workflow_name=workflow)
    structure = workflow_processor.get_workflow_structure_name(workflow)
    template = workflow_processor.get_workflow_template(database, structure)
    record = prepare_evaluation_record(template)
    evaluation_maker = evaluation_model.make_evaluation_closure(workflow, template)
    evaluation = evaluation_maker(evaluation)
    evaluation = evaluation_dao.add_evaluation(database, evaluation)
    ordered_functions = get_ordered_evaluation_functions(project, workflow)
    record_translator = get_record_translator(ordered_functions)
    prepared_functions = get_prepared_evaluation_functions(project, workflow, ordered_functions)
    evaluation_functions = []
    for function in prepared_functions:
        if has_inputs(function):
            function = update_function_inputs(project, workflow, function, record, output_dictionary)
        result = language_processor.route_function(project, function)
        function['output'] = function['hold_output']
        if validate_data_targets(function, result['output']):
            record = update_evaluation_record(record, result['output'],
                                              record_translator[function['order']])
            output_dictionary = update_function_output_dictionary(function, result['output'], output_dictionary)
        evaluation_functions.append(evaluation_model.make_evaluation_function(function, result['info']))
    evaluation = evaluation_model.update_evaluation_functions(evaluation, evaluation_functions)
    record = mars.record.add_new_record(database, template, record)
    evaluation = evaluation_model.update_evaluation_record(evaluation, record)
    evaluation = evaluation_dao.update_evaluation(database, evaluation,
                                                  changes=['functions', 'record', 'info'])
    return evaluation
def test_named_evaluation_workflow(project):
    """Tests creating evaluations of a workflow that uses a named evaluation of a workflow.
    """
    test_workflow = workflow_processor.get_workflow(project, workflow_name='test_named_evaluation')
    num_times = 10
    evaluations = evaluation_test.test_make_evaluations(project, test_workflow, count=num_times,)
    print('Evaluations: ')
    print(evaluations)
    print('')
    print('')
    print('Getting the records for the evaluations: ')
    records = evaluation_test.test_get_evaluation_records(project, evaluations)
    print('Records: ')
    print(records)
    print('')
    print('')
Ejemplo n.º 3
0
def test_named_evaluation_workflow(harness):
    """Tests creating evaluations of a workflow that uses a named evaluation of a workflow.
    """
    test_workflow = workflow_processor.get_workflow(harness, workflow_name='test_named_evaluation')
    num_times = 10
    evaluations = evaluation_test.test_make_evaluations(harness, test_workflow, count=num_times)
    print 'Evaluations: '
    print evaluations
    print ''
    print ''
    print 'Getting the records for the evaluations: '
    records = evaluation_test.test_get_evaluation_records(harness, evaluations)
    print 'Records: '
    print records
    print ''
    print ''
def test_custom_structure_workflow(project):
    """Tests creating evaluations of a workflow that uses a named evaluation of a workflow.
    """
    test_workflow = workflow_processor.get_workflow(project, workflow_name='get_coordinate_multiple')
    num_times = 10
    evaluations = evaluation_test.test_make_evaluations(project, test_workflow, count=num_times)
    print('Evaluations: ')
    print(evaluations)
    print('')
    print('')
    print('Getting the records for the evaluations: ')
    records = evaluation_test.test_get_evaluation_records(project, evaluations)
    print('Records: ')
    print(records)
    print('')
    print('')
    return records
Ejemplo n.º 5
0
def test_custom_structure_workflow(harness):
    """Tests creating evaluations of a workflow that uses a named evaluation of a workflow.
    """
    test_workflow = workflow_processor.get_workflow(harness, workflow_name='get_coordinate_multiple')
    num_times = 10
    evaluations = evaluation_test.test_make_evaluations(harness, test_workflow, count=num_times)
    print 'Evaluations: '
    print evaluations
    print ''
    print ''
    print 'Getting the records for the evaluations: '
    records = evaluation_test.test_get_evaluation_records(harness, evaluations)
    print 'Records: '
    print records
    print ''
    print ''
    return records
def test_get_workflow(project, workflow_name):
    """Gets a workflow by the name and project.
    """
    return workflow_processor.get_workflow(project, workflow_name=workflow_name)
Ejemplo n.º 7
0
def test_get_workflow(harness, workflow_name):
    """Gets a workflow by the name and harness.
    """
    return workflow_processor.get_workflow(harness, workflow_name=workflow_name)