Skip to content

Commit

Permalink
Update bunch classes to collect bundle id
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiswl committed Jun 25, 2024
1 parent 928b57d commit dcc1d2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/cwl_ica/classes/icav2_bunch_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ def create_bundle_from_bunch_version(self, icav2_access_token: str):
:return:
"""

bundle_obj = generate_empty_bundle(
self.bundle_id = generate_empty_bundle(
bundle_name=self.bundle_name,
bundle_version=self.bundle_version,
bundle_description=self.bundle_description,
Expand All @@ -1068,9 +1068,6 @@ def create_bundle_from_bunch_version(self, icav2_access_token: str):
icav2_access_token=icav2_access_token,
)

# Get bundle id
self.bundle_id = bundle_obj.id

# Set bundle url
self.bundle_url = f"https://ica.illumina.com/ica/bundles/{self.bundle_id}/bundleDetails"

Expand Down
22 changes: 13 additions & 9 deletions src/cwl_ica/utils/icav2_gh_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from urllib.parse import urlparse
import json
from ruamel.yaml import YAML, CommentedMap, CommentedSeq
from wrapica.bundle import get_bundle_obj_from_bundle_id

# Wrapica
from wrapica.data import Data
Expand Down Expand Up @@ -514,7 +515,7 @@ def generate_empty_bundle(
categories: List[str],
pipeline_release_url: str,
icav2_access_token: str
):
) -> str:
"""
Generate an empty bundle
:param bundle_name:
Expand All @@ -525,7 +526,7 @@ def generate_empty_bundle(
:param categories:
:param pipeline_release_url:
:param icav2_access_token:
:return:
:return: The bundle id
"""
# Create pipeline from GitHub release
proc_environ = os.environ.copy()
Expand All @@ -537,7 +538,7 @@ def generate_empty_bundle(
}
)

link_data_command = [
generate_empty_bundle_command = [
f"{os.environ['ICAV2_CLI_PLUGINS_HOME']}/pyenv/bin/python",
f"{os.environ['ICAV2_CLI_PLUGINS_HOME']}/pyenv/bin/icav2-cli-plugins.py",
"bundles",
Expand All @@ -546,23 +547,26 @@ def generate_empty_bundle(
"--short-description", bundle_description,
"--bundle-version", bundle_version,
"--bundle-version-description", bundle_version_description,
"--json"
]

# Extend with categories
for category in categories:
link_data_command.extend(["--category", category])
generate_empty_bundle_command.extend(["--category", category])

link_data_returncode, link_data_stdout, link_data_stderr = run_subprocess_proc(
link_data_command,
generate_empty_bundle_returncode, generate_empty_bundle_stdout, generate_empty_bundle_stderr = run_subprocess_proc(
generate_empty_bundle_command,
env=proc_environ,
capture_output=True
)

if not link_data_returncode == 0:
logger.error(f"{link_data_stdout}")
logger.error(f"{link_data_stderr}")
if not generate_empty_bundle_returncode == 0:
logger.error(f"{generate_empty_bundle_stdout}")
logger.error(f"{generate_empty_bundle_stderr}")
raise ChildProcessError

return json.loads(generate_empty_bundle_stdout).get("id")


def add_data_to_bundle(bundle_id, data_id, icav2_access_token: str):
"""
Expand Down

0 comments on commit dcc1d2b

Please sign in to comment.