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()
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()
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, )
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, )
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()
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)
def test_traverse_workflow() -> None: """Test the citation extraction, simply.""" loaded = parser.load_document(str(TEST_CWL.resolve())) traverse_workflow(loaded)
def main() -> int: """Load the first argument and extract the software requirements.""" top = cwl.load_document(sys.argv[1]) traverse(top) return 0