cloudos-cli 2.29.0__tar.gz → 2.30.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/PKG-INFO +5 -5
  2. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/README.md +4 -4
  3. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/__main__.py +11 -13
  4. cloudos_cli-2.30.0/cloudos_cli/_version.py +1 -0
  5. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/import_wf/__init__.py +1 -1
  6. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/import_wf/import_wf.py +33 -29
  7. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/PKG-INFO +5 -5
  8. cloudos_cli-2.29.0/cloudos_cli/_version.py +0 -1
  9. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/LICENSE +0 -0
  10. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/__init__.py +0 -0
  11. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/clos.py +0 -0
  12. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/configure/__init__.py +0 -0
  13. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/configure/configure.py +0 -0
  14. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/datasets/__init__.py +0 -0
  15. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/datasets/datasets.py +0 -0
  16. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/jobs/__init__.py +0 -0
  17. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/jobs/job.py +0 -0
  18. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/queue/__init__.py +0 -0
  19. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/queue/queue.py +0 -0
  20. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/utils/__init__.py +0 -0
  21. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/utils/errors.py +0 -0
  22. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/utils/requests.py +0 -0
  23. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli/utils/resources.py +0 -0
  24. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/SOURCES.txt +0 -0
  25. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  26. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  27. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/requires.txt +0 -0
  28. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  29. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/setup.cfg +0 -0
  30. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/setup.py +0 -0
  31. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/tests/__init__.py +0 -0
  32. {cloudos_cli-2.29.0 → cloudos_cli-2.30.0}/tests/functions_for_pytest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.29.0
3
+ Version: 2.30.0
4
4
  Summary: Python package for interacting with CloudOS
5
5
  Home-page: https://github.com/lifebit-ai/cloudos-cli
6
6
  Author: David Piñeyro
@@ -695,8 +695,8 @@ The collected workflows are those that can be found in "WORKSPACE TOOLS" section
695
695
  You can import new workflows to your CloudOS workspaces. The only requirements are:
696
696
 
697
697
  - The workflow is a Nextflow pipeline.
698
- - The workflow repository is located at GitHub or GitLab (specified by the option `--platform`. Available options: `github`, `gitlab`)
699
- - If your repository is private, you have access to the repository and you have linked your GitHub or Bitbucket server accounts to CloudOS.
698
+ - The workflow repository is located at GitHub, GitLab or BitBucket Server (specified by the option `--repository-platform`. Available options: `github`, `gitlab` and `bitbucketServer`)
699
+ - If your repository is private, you have access to the repository and to have linked your GitHub, Gitlab or Bitbucket server accounts to CloudOS.
700
700
 
701
701
  #### Usage of the workflow import command
702
702
 
@@ -712,7 +712,7 @@ cloudos workflow import \
712
712
  --workspace-id $WORKSPACE_ID \
713
713
  --workflow-url $WORKFLOW_URL \
714
714
  --workflow-name "new_name_for_the_github_workflow" \
715
- --platform github
715
+ --repository-platform github
716
716
  ```
717
717
 
718
718
  The expected output will be:
@@ -737,7 +737,7 @@ cloudos workflow import \
737
737
  --workflow-url $WORKFLOW_URL \
738
738
  --workflow-name "new_name_for_the_github_workflow" \
739
739
  --workflow-docs-link "https://github.com/lifebit-ai/DeepVariant/blob/master/README.md" \
740
- --platform github
740
+ --repository-platform github
741
741
  ```
742
742
 
743
743
  > NOTE: please, take into account that importing workflows using cloudos-cli is not yet available in all the CloudOS workspaces. If you try to use this feature in a non-prepared workspace you will get the following error message: `It seems your API key is not authorised. Please check if your workspace has support for importing workflows using cloudos-cli`.
@@ -660,8 +660,8 @@ The collected workflows are those that can be found in "WORKSPACE TOOLS" section
660
660
  You can import new workflows to your CloudOS workspaces. The only requirements are:
661
661
 
662
662
  - The workflow is a Nextflow pipeline.
663
- - The workflow repository is located at GitHub or GitLab (specified by the option `--platform`. Available options: `github`, `gitlab`)
664
- - If your repository is private, you have access to the repository and you have linked your GitHub or Bitbucket server accounts to CloudOS.
663
+ - The workflow repository is located at GitHub, GitLab or BitBucket Server (specified by the option `--repository-platform`. Available options: `github`, `gitlab` and `bitbucketServer`)
664
+ - If your repository is private, you have access to the repository and to have linked your GitHub, Gitlab or Bitbucket server accounts to CloudOS.
665
665
 
666
666
  #### Usage of the workflow import command
667
667
 
@@ -677,7 +677,7 @@ cloudos workflow import \
677
677
  --workspace-id $WORKSPACE_ID \
678
678
  --workflow-url $WORKFLOW_URL \
679
679
  --workflow-name "new_name_for_the_github_workflow" \
680
- --platform github
680
+ --repository-platform github
681
681
  ```
682
682
 
683
683
  The expected output will be:
@@ -702,7 +702,7 @@ cloudos workflow import \
702
702
  --workflow-url $WORKFLOW_URL \
703
703
  --workflow-name "new_name_for_the_github_workflow" \
704
704
  --workflow-docs-link "https://github.com/lifebit-ai/DeepVariant/blob/master/README.md" \
705
- --platform github
705
+ --repository-platform github
706
706
  ```
707
707
 
708
708
  > NOTE: please, take into account that importing workflows using cloudos-cli is not yet available in all the CloudOS workspaces. If you try to use this feature in a non-prepared workspace you will get the following error message: `It seems your API key is not authorised. Please check if your workspace has support for importing workflows using cloudos-cli`.
@@ -3,7 +3,7 @@
3
3
  import rich_click as click
4
4
  import cloudos_cli.jobs.job as jb
5
5
  from cloudos_cli.clos import Cloudos
6
- from cloudos_cli.import_wf.import_wf import ImportGitlab, ImportGithub
6
+ from cloudos_cli.import_wf.import_wf import ImportWorflow
7
7
  from cloudos_cli.queue.queue import Queue
8
8
  from cloudos_cli.utils.errors import BadRequestException
9
9
  import json
@@ -289,7 +289,7 @@ def configure(ctx, profile, make_default):
289
289
  '--cromwell-token',
290
290
  help=('Specific Cromwell server authentication token. Currently, not necessary ' +
291
291
  'as apikey can be used instead, but maintained for backwards compatibility.'))
292
- @click.option('--repository-platform',
292
+ @click.option('--repository-platform', type=click.Choice(["github", "gitlab", "bitbucketServer"]),
293
293
  help='Name of the repository platform of the workflow. Default=github.',
294
294
  default='github')
295
295
  @click.option('--execution-platform',
@@ -1250,10 +1250,9 @@ def list_workflows(ctx,
1250
1250
  @click.option('--workspace-id',
1251
1251
  help='The specific CloudOS workspace id.',
1252
1252
  required=True)
1253
- @click.option("--platform", type=click.Choice(["github", "gitlab"]),
1254
- help=('Repository service where the workflow is located. Valid choices: github, gitlab. ' +
1255
- 'Default=github'),
1256
- default="github")
1253
+ @click.option('--repository-platform', type=click.Choice(["github", "gitlab", "bitbucketServer"]),
1254
+ help='Name of the repository platform of the workflow. Default=github.',
1255
+ default='github')
1257
1256
  @click.option("--workflow-name", help="The name that the workflow will have in CloudOS.", required=True)
1258
1257
  @click.option("-w", "--workflow-url", help="URL of the workflow repository.", required=True)
1259
1258
  @click.option("-d", "--workflow-docs-link", help="URL to the documentation of the workflow.", default='')
@@ -1276,7 +1275,7 @@ def import_wf(ctx,
1276
1275
  workflow_docs_link,
1277
1276
  cost_limit,
1278
1277
  workflow_description,
1279
- platform,
1278
+ repository_platform,
1280
1279
  disable_ssl_verification,
1281
1280
  ssl_cert,
1282
1281
  profile):
@@ -1303,15 +1302,14 @@ def import_wf(ctx,
1303
1302
  apikey=apikey,
1304
1303
  cloudos_url=cloudos_url,
1305
1304
  workspace_id=workspace_id,
1306
- workflow_name=workflow_name
1305
+ workflow_name=workflow_name,
1306
+ repository_platform=repository_platform
1307
1307
  )
1308
1308
  )
1309
1309
 
1310
1310
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1311
- repo_services = {"gitlab": ImportGitlab, "github": ImportGithub}
1312
- repo_cls = repo_services[platform]
1313
- repo_import = repo_cls(cloudos_url=cloudos_url, cloudos_apikey=apikey, workspace_id=workspace_id,
1314
- platform=platform, workflow_name=workflow_name, workflow_url=workflow_url,
1311
+ repo_import = ImportWorflow(cloudos_url=cloudos_url, cloudos_apikey=apikey, workspace_id=workspace_id,
1312
+ platform=repository_platform, workflow_name=workflow_name, workflow_url=workflow_url,
1315
1313
  workflow_docs_link=workflow_docs_link, cost_limit=cost_limit, workflow_description=workflow_description, verify=verify_ssl)
1316
1314
  workflow_id = repo_import.import_workflow()
1317
1315
  print(f'\tWorkflow {workflow_name} was imported successfully with the ' +
@@ -1865,7 +1863,7 @@ def remove_profile(ctx, profile):
1865
1863
  help=('Max time to wait (in seconds) to job completion. ' +
1866
1864
  'Default=3600.'),
1867
1865
  default=3600)
1868
- @click.option('--repository-platform',
1866
+ @click.option('--repository-platform', type=click.Choice(["github", "gitlab", "bitbucketServer"]),
1869
1867
  help='Name of the repository platform of the workflow. Default=github.',
1870
1868
  default='github')
1871
1869
  @click.option('--execution-platform',
@@ -0,0 +1 @@
1
+ __version__ = '2.30.0'
@@ -2,7 +2,7 @@
2
2
  Functions and classes related to importing workflows into CloudOS.
3
3
  """
4
4
 
5
- from .import_wf import WFImport, ImportGitlab, ImportGithub
5
+ from .import_wf import WFImport, ImportWorflow
6
6
 
7
7
 
8
8
  __all__ = ['import_wf']
@@ -3,6 +3,8 @@ from urllib.parse import urlsplit
3
3
  from cloudos_cli.utils.errors import BadRequestException, AccountNotLinkedException
4
4
  from cloudos_cli.utils.requests import retry_requests_post, retry_requests_get
5
5
  import json
6
+ from requests.exceptions import RetryError
7
+ import sys
6
8
 
7
9
 
8
10
  class WFImport(ABC):
@@ -96,44 +98,46 @@ class WFImport(ABC):
96
98
  return content["_id"]
97
99
 
98
100
 
99
- # There are some duplicated lines here and on the github subclass. I did not put them in the abstract class because we
100
- # still don't know if the bitbucket data will come the same. If it does, then I will put as much as possible as part
101
- # of the abstract class
102
- class ImportGitlab(WFImport):
101
+ class ImportWorflow(WFImport):
103
102
  def get_repo(self):
104
- get_repo_url = f"{self.cloudos_url}/api/v1/git/gitlab/getPublicRepo"
105
- self.repo_name = self.parsed_url.path.split("/")[-1]
106
- self.repo_owner = "/".join(self.parsed_url.path.split("/")[1:-1])
103
+ get_repo_url = f"{self.cloudos_url}/api/v1/git/{self.platform}/getPublicRepo"
104
+ if self.platform == "bitbucketServer":
105
+ # platform allows to add paths like /browse, so we need to check if the path ends with it
106
+ if self.parsed_url.path.endswith("browse"):
107
+ self.repo_name = self.parsed_url.path.split("/")[-2]
108
+ else:
109
+ self.repo_name = self.parsed_url.path.split("/")[-1]
110
+ self.repo_owner = self.parsed_url.path.split("/")[2]
111
+ else:
112
+ self.repo_name = self.parsed_url.path.split("/")[-1]
113
+ self.repo_owner = "/".join(self.parsed_url.path.split("/")[1:-1])
107
114
  self.repo_host = f"{self.parsed_url.scheme}://{self.parsed_url.netloc}"
108
115
  get_repo_params = dict(repoName=self.repo_name, repoOwner=self.repo_owner, host=self.repo_host, teamId=self.workspace_id)
109
- r = retry_requests_get(get_repo_url, params=get_repo_params, headers=self.headers)
110
- if r.status_code == 404:
116
+ try:
117
+ r = retry_requests_get(get_repo_url, params=get_repo_params, headers=self.headers)
118
+ except RetryError as e:
119
+ # RetryError getting from missing BitBucket Server credentials
111
120
  raise AccountNotLinkedException(self.workflow_url)
112
- elif r.status_code >= 400:
113
- raise BadRequestException(r)
114
- r_data = r.json()
115
- self.payload["repository"]["repositoryId"] = r_data["id"]
116
- self.payload["repository"]["name"] = r_data["name"]
117
- self.payload["repository"]["owner"]["id"] = r_data["namespace"]["id"]
118
- self.payload["repository"]["owner"]["login"] = r_data["namespace"]["full_path"]
119
- self.payload["mainFile"] = self.main_file or self.get_repo_main_file()
120
121
 
121
-
122
- class ImportGithub(WFImport):
123
- def get_repo(self):
124
- get_repo_url = f"{self.cloudos_url}/api/v1/git/github/getPublicRepo"
125
- self.repo_name = self.parsed_url.path.split("/")[-1]
126
- self.repo_owner = "/".join(self.parsed_url.path.split("/")[1:-1])
127
- self.repo_host = f"{self.parsed_url.scheme}://{self.parsed_url.netloc}"
128
- get_repo_params = dict(repoName=self.repo_name, repoOwner=self.repo_owner, host=self.repo_host, teamId=self.workspace_id)
129
- r = retry_requests_get(get_repo_url, params=get_repo_params, headers=self.headers)
122
+ # for Github and Gitlab the API gives very general errors on missing credentials
123
+ # therefore we only have these at the moment
130
124
  if r.status_code == 404:
131
125
  raise AccountNotLinkedException(self.workflow_url)
132
126
  elif r.status_code >= 400:
133
127
  raise BadRequestException(r)
128
+
134
129
  r_data = r.json()
135
- self.payload["repository"]["repositoryId"] = r_data["id"]
130
+ if self.platform == "bitbucketServer":
131
+ self.payload["repository"]["repositoryId"] = r_data["name"]
132
+ else:
133
+ self.payload["repository"]["repositoryId"] = r_data["id"]
136
134
  self.payload["repository"]["name"] = r_data["name"]
137
- self.payload["repository"]["owner"]["id"] = r_data["owner"]["id"]
138
- self.payload["repository"]["owner"]["login"] = r_data["owner"]["login"]
135
+ owner_data = {
136
+ "bitbucketServer": ("project", "id", "key"),
137
+ "gitlab": ("namespace", "id", "full_path"),
138
+ "github": ("owner", "id", "login")
139
+ }
140
+ key, id_field, login_field = owner_data[self.platform]
141
+ self.payload["repository"]["owner"]["id"] = r_data[key][id_field]
142
+ self.payload["repository"]["owner"]["login"] = r_data[key][login_field]
139
143
  self.payload["mainFile"] = self.main_file or self.get_repo_main_file()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.29.0
3
+ Version: 2.30.0
4
4
  Summary: Python package for interacting with CloudOS
5
5
  Home-page: https://github.com/lifebit-ai/cloudos-cli
6
6
  Author: David Piñeyro
@@ -695,8 +695,8 @@ The collected workflows are those that can be found in "WORKSPACE TOOLS" section
695
695
  You can import new workflows to your CloudOS workspaces. The only requirements are:
696
696
 
697
697
  - The workflow is a Nextflow pipeline.
698
- - The workflow repository is located at GitHub or GitLab (specified by the option `--platform`. Available options: `github`, `gitlab`)
699
- - If your repository is private, you have access to the repository and you have linked your GitHub or Bitbucket server accounts to CloudOS.
698
+ - The workflow repository is located at GitHub, GitLab or BitBucket Server (specified by the option `--repository-platform`. Available options: `github`, `gitlab` and `bitbucketServer`)
699
+ - If your repository is private, you have access to the repository and to have linked your GitHub, Gitlab or Bitbucket server accounts to CloudOS.
700
700
 
701
701
  #### Usage of the workflow import command
702
702
 
@@ -712,7 +712,7 @@ cloudos workflow import \
712
712
  --workspace-id $WORKSPACE_ID \
713
713
  --workflow-url $WORKFLOW_URL \
714
714
  --workflow-name "new_name_for_the_github_workflow" \
715
- --platform github
715
+ --repository-platform github
716
716
  ```
717
717
 
718
718
  The expected output will be:
@@ -737,7 +737,7 @@ cloudos workflow import \
737
737
  --workflow-url $WORKFLOW_URL \
738
738
  --workflow-name "new_name_for_the_github_workflow" \
739
739
  --workflow-docs-link "https://github.com/lifebit-ai/DeepVariant/blob/master/README.md" \
740
- --platform github
740
+ --repository-platform github
741
741
  ```
742
742
 
743
743
  > NOTE: please, take into account that importing workflows using cloudos-cli is not yet available in all the CloudOS workspaces. If you try to use this feature in a non-prepared workspace you will get the following error message: `It seems your API key is not authorised. Please check if your workspace has support for importing workflows using cloudos-cli`.
@@ -1 +0,0 @@
1
- __version__ = '2.29.0'
File without changes
File without changes
File without changes