Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flag added to control downloading of all versions of RO Crates, or only latest version #20

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion workflowhub_graph/source_crates.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def process_workflow_ids(
:param is_metadata_endpoint: A boolean flag to determine if method should call
download_and_extract_json_from_zip() or download_and_extract_json_from_metadata_endpoint().
:param base_url: The base URL.
:param all_versions: A boolean flag to determine if all versions of a workflow should be processed.
"""
os.makedirs(output_dir, exist_ok=True)

Expand Down Expand Up @@ -241,6 +242,12 @@ def main():
action="store_true",
help="Use the production WorkflowHub.",
)
parser.add_argument(
"--all-versions",
default=False,
action="store_true",
help="Download all versions of an RO Crate. If not set, only the latest version will be downloaded.",
)

args = parser.parse_args()

Expand Down Expand Up @@ -273,7 +280,10 @@ def main():
# Check if root key 'data' exists
if workflows_ids and "data" in workflows_ids:
process_workflow_ids(
workflows_ids, is_metadata_endpoint=True, base_url=base_url
workflows_ids,
is_metadata_endpoint=True,
base_url=base_url,
all_versions=args.all_versions,
)


Expand Down
Loading