Пример #1
0
    def test_packed_workflow(self, mock_dateutil):
        mock_dateutil.parser.parse.return_value.strftime.return_value = 'somedate'
        paths, job = Mock(), Mock()
        paths.JOB_DATA = '/job-data'
        paths.OUTPUT_DATA = '/output-data'
        paths.CONFIG_DIR = '/config'
        paths.WORKFLOW = '/workflowdir'
        job.id = 49
        job.name = 'myjob'
        job.username = '******'
        job.workflow.name = 'myworkflow'
        job.workflow.version = 2
        job.workflow.workflow_url = 'someurl'
        job.workflow.workflow_type = WorkflowTypes.PACKED
        job.workflow.workflow_path = 'workflow.cwl'
        names = Names(job, paths)

        self.assertEqual(names.job_order_path, '/job-data/job-order.json')
        self.assertEqual(names.run_workflow_stdout_path,
                         '/output-data/bespin-workflow-output.json')
        self.assertEqual(names.run_workflow_stderr_path,
                         '/output-data/bespin-workflow-output.log')
        self.assertEqual(names.output_project_name,
                         'Bespin myworkflow v2 myjob somedate')
        self.assertEqual(names.workflow_input_files_metadata_path,
                         '/job-data/workflow-input-files-metadata.json')
        self.assertEqual(names.usage_report_path,
                         '/output-data/job-49-joe-resource-usage.json')
        self.assertEqual(names.activity_name, 'myjob - Bespin Job 49')
        self.assertEqual(names.activity_description,
                         'Bespin Job 49 - Workflow myworkflow v2')

        self.assertEqual(names.stage_data_command_filename,
                         '/config/stage_data.json')
        self.assertEqual(names.organize_output_command_filename,
                         '/config/organize_output.json')
        self.assertEqual(names.save_output_command_filename,
                         '/config/save_output.json')
        self.assertEqual(names.output_project_details_filename,
                         '/config/output_project_details.json')
        self.assertEqual(names.dds_config_filename, '/config/ddsclient.conf')

        self.assertEqual(names.workflow_download_dest, '/workflowdir/someurl')
        self.assertEqual(names.workflow_to_run,
                         '/workflowdir/someurlworkflow.cwl')
        self.assertEqual(names.workflow_to_read, '/workflowdir/someurl')
        self.assertEqual(names.unzip_workflow_url_to_path, None)
Пример #2
0
    def test_zipped_workflow(self, mock_dateutil):
        mock_dateutil.parser.parse.return_value.strftime.return_value = 'somedate'
        paths, job = Mock(), Mock()
        paths.JOB_DATA = '/job-data'
        paths.OUTPUT_DATA = '/output-data'
        paths.CONFIG_DIR = '/config'
        paths.WORKFLOW = '/workflowdir'
        job.id = 49
        job.name = 'myjob'
        job.username = '******'
        job.workflow.name = 'myworkflow'
        job.workflow.version = 2
        job.workflow.workflow_url = 'someurl'
        job.workflow.workflow_type = WorkflowTypes.ZIPPED
        job.workflow.workflow_path = 'workflow.cwl'
        names = BaseNames(job, paths)

        self.assertEqual(names.workflow_download_dest, '/workflowdir/someurl')
        self.assertEqual(names.workflow_to_run, '/workflowdir/workflow.cwl')
        self.assertEqual(names.workflow_to_read, '/workflowdir/workflow.cwl')
        self.assertEqual(names.unzip_workflow_url_to_path, '/workflowdir')