コード例 #1
0
def test_traverse_workflow_singularity() -> None:
    """Test container extraction tool using Singularity."""
    loaded = parser.load_document(str(TEST_CWL.resolve()))

    with TemporaryDirectory() as tmpdir:
        for req in set(traverse(loaded)):
            assert req.dockerPull
            image_puller = SingularityImagePuller(req.dockerPull, tmpdir)
            image_puller.save_docker_image()
コード例 #2
0
def test_traverse_workflow() -> None:
    """Test container extraction tool using Docker."""
    loaded = parser.load_document(str(TEST_CWL.resolve()))

    with TemporaryDirectory() as tmpdir:
        for req in set(traverse(loaded)):
            assert req.dockerPull
            image_puller = DockerImagePuller(req.dockerPull, tmpdir)
            image_puller.save_docker_image()
            _ = image_puller.generate_udocker_loading_command()
コード例 #3
0
def test_v1_0_workflow_top_level_sf_expr_array() -> None:
    """Test for the correct error when converting a secondaryFiles expression (array form) in a workflow level input."""
    with raises(WorkflowException, match=r".*secondaryFiles.*"):
        result, modified = traverse0(
            parser.load_document(
                str(HERE / "../testdata/workflow_input_sf_expr_array.cwl")),
            False,
            False,
            False,
            False,
        )
コード例 #4
0
def test_v1_0_workflow_top_level_format_expr() -> None:
    """Test for the correct error when converting a format expression in a workflow level input."""
    with raises(WorkflowException, match=r".*format specification.*"):
        result, modified = traverse0(
            parser.load_document(
                str(HERE / "../testdata/workflow_input_format_expr.cwl")),
            False,
            False,
            False,
            False,
        )
コード例 #5
0
def main(args: argparse.Namespace) -> None:
    """Extract the docker reqs and download them using Singularity or docker."""
    os.makedirs(args.dir, exist_ok=True)

    top = cwl.load_document(args.input)

    for req in traverse(top):
        if not req.dockerPull:
            print(
                f"Unable to save image from {req} due to lack of 'dockerPull'."
            )
            continue
        if args.singularity:
            image_puller: ImagePuller = SingularityImagePuller(
                req.dockerPull, args.dir)
        else:
            image_puller = DockerImagePuller(req.dockerPull, args.dir)
        image_puller.save_docker_image()
コード例 #6
0
def get_process_from_step(step: cwl.WorkflowStep) -> ProcessType:
    """Return the process for this step, loading it if necessary."""
    if isinstance(step.run, str):
        return cast(ProcessType, cwl.load_document(step.run))
    return cast(ProcessType, step.run)
コード例 #7
0
def test_traverse_workflow() -> None:
    """Test the citation extraction, simply."""
    loaded = parser.load_document(str(TEST_CWL.resolve()))
    traverse_workflow(loaded)
コード例 #8
0
def main() -> int:
    """Load the first argument and extract the software requirements."""
    top = cwl.load_document(sys.argv[1])
    traverse(top)
    return 0