2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: Apache-2.0
8 # Merge two or more collections together. Can also be used to extract specific
9 # files from a collection to produce a new collection.
12 # An array of collections or collection/file paths in script_parameter["input"]
15 # A manifest with the collections merged. Duplicate file names will
16 # have their contents concatenated in the order that they appear in the input
21 import crunchutil.subst as subst
26 p = arvados.current_job()['script_parameters']
31 c = subst.do_substitution(p, c)
35 merged += arvados.CollectionReader(c).manifest_text()
38 cr = arvados.CollectionReader(c[0:i])
44 for s in cr.all_streams():
45 if s.name() == stream:
47 merged += s.files()[fn].as_manifest()
49 arvados.current_task().set_output(merged)