def test_quast_complete_run_through():
    app = app_helper.setup_app_state('quast', 'execute')
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/684281f282'))
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/container_log/86bbc499b0'))
def test_gaet_complete_run_through():
    app = app_helper.setup_app_state('gaet', 'execute')
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/d70c163200'))
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/container_log/1661337965'))
def test_complete_run_through():
    app = app_helper.setup_app_state('sra', 'inputs')
    image_helper.execute_image(app)

    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/contig_fasta/01eb7cec61'))
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/container_runtime_metrics/metrics.json.gz'))
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/container_log/1099992390'))
def test_execution_with_empty_contig_file():
    app = app_helper.setup_app_state('quast', 'execute')
    input_contigs = fs.get_task_file_path(app,
                                          "inputs/contig_fasta/de3d9f6d31.fa")
    open(input_contigs, "w").truncate()

    image_helper.execute_image(app)
    file_helper.assert_is_empty_directory(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/'))
    file_helper.assert_is_empty_directory(
        fs.get_task_file_path(app, 'outputs/container_log/'))
def test_failing_image_with_log_output():
    image = {
        "name": "bioboxes/crash-test-biobox",
        "sha256":
        "eaf1ab35314712db9d3fff0d265613629fe628ed9b058a9a4fe94424184f8c41",
        "task": "exit-1-with-log",
        "type": "short_read_assembler"
    }
    app = app_helper.setup_app_state('sra', 'inputs')
    app["task"]["image"] = image
    app_helper.rewrite_app_task(app)
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(
            app, 'outputs/container_runtime_metrics/metrics.json.gz'))
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/container_log/1d4dba8a3c'))
def test_copy_container_output_files_with_intermediates():
    app = app_helper.setup_app_state('quast', 'intermediates')
    input_files = {
        'container_log': 'meta/log.txt',
        'assembly_metrics': 'tmp/report.tsv'
    }
    output_files = ['assembly_metrics/63d2a18fa1', 'container_log/e0e8af3790']

    fs.copy_container_output_files(app, input_files)
    for f in output_files:
        loc = fs.get_task_file_path(app, "outputs/" + f)
        assert os.path.isfile(loc), "Output file should be copied: {}".format(
            loc)
    def collect_metrics(self, app):
        import json, gzip
        path = fs.get_task_file_path(
            app, "outputs/container_runtime_metrics/metrics.json.gz")

        if not os.path.isfile(path):
            return {}

        with gzip.open(path) as f:
            raw_metrics = json.loads(f.read())

        mapping_file = os.path.join('mappings',
                                    self.metric_mapping_file(app) + '.yml')
        mapping = yaml.safe_load(util.get_asset_file_contents(mapping_file))
        return met.process_raw_metrics(app, raw_metrics, mapping)
예제 #8
0
def copy_output_files(app):
    """
    Creates a list of source file paths and destination directory names. Copies each
    the source file to destination directory.
    """
    path = lambda x: os.path.abspath(fs.get_task_file_path(app, x))

    output_files = {'container_log': path('meta/log.txt')}

    if fs.biobox_yaml_exists(app):
        tmp_files = funcy.walk_values(lambda x: path("tmp/" + x),
                                      image_type(app).output_file_paths(app))
        output_files = funcy.merge(output_files, tmp_files)
    else:
        msg = "No biobox.yaml file created, cannot find paths of any container generated files"
        app['logger'].warn(msg)

    fs.copy_container_output_files(app, output_files)
def test_copy_output_files():
    app = app_helper.setup_app_state('sra', 'intermediates')
    run.copy_output_files(app)
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/container_log/e0e8af3790'))
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/contig_fasta/de3d9f6d31'))
def test_output_file_paths():
    app = app_helper.setup_app_state('sra', 'intermediates')
    paths = task().output_file_paths(app)
    for (_, f) in paths.items():
        location = fs.get_task_file_path(app, "tmp/" + f)
        nose.assert_true(os.path.isfile(location))