示例#1
0
    def test_should_load_task_definitions_with_weird_names(self):
        dag_content = '''
TASK ID000 Genome::filterContams_chr21:1.0 10.0
TASK ID001 Genome::filterContams_chr21:1.0 10.0
        '''

        dag = dag_loader.parse_dag(dag_content)
        expected_tasks = [
            workflow.Task('ID000', 10.0, 'Genome::filterContams_chr21:1.0'),
            workflow.Task('ID001', 10.0, 'Genome::filterContams_chr21:1.0')
        ]

        self.assertListEqual(expected_tasks, dag.tasks)
示例#2
0
    def test_should_load_task_definitions(self):
        dag_content = '''
TASK ID000 preprocess 10.0
TASK ID001 process 10.0
        '''

        dag = dag_loader.parse_dag(dag_content)
        expected_tasks = [
            workflow.Task('ID000', 10.0, 'preprocess'),
            workflow.Task('ID001', 10.0, 'process')
        ]

        self.assertListEqual(expected_tasks, dag.tasks)
示例#3
0
    def test_should_load_files_definitions(self):
        dag_content = '''
FILE in1.txt 100
FILE in2.txt 100
        '''

        dag = dag_loader.parse_dag(dag_content)
        expected_files = [
            workflow.File('in1.txt', 100),
            workflow.File('in2.txt', 100)
        ]

        self.assertListEqual(expected_files, dag.files)
示例#4
0
    def test_should_load_edges_definition(self):
        dag_content = '''
TASK ID000 preprocess 10.0
TASK ID001 process 10.0
TASK ID002 postprocess 10.0

EDGE ID000 ID001
EDGE ID001 ID002
        '''
        dag = dag_loader.parse_dag(dag_content)

        task_id000 = next((task for task in dag.tasks if task.id == 'ID000'))
        task_id001 = next((task for task in dag.tasks if task.id == 'ID001'))
        task_id002 = next((task for task in dag.tasks if task.id == 'ID002'))

        self.assertIn(task_id001, task_id000.after)
        self.assertIn(task_id000, task_id001.before)

        self.assertIn(task_id002, task_id001.after)
        self.assertIn(task_id001, task_id002.before)
def load_dag(workflow):
    dag_file = open(workflow.filename, 'r')
    dag = dag_loader.parse_dag(dag_file.read())
    dag.id = workflow.id
    dag_file.close()
    return dag
示例#6
0
def load_dag(workflow):
    dag_file = open(workflow.filename, 'r')
    dag = dag_loader.parse_dag(dag_file.read())
    dag.id = workflow.id
    dag_file.close()
    return dag