pybioos 0.0.14__py3-none-any.whl → 0.0.15__py3-none-any.whl

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.
bioos/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # coding:utf-8
2
2
 
3
3
  # Package version
4
- __version__ = "0.0.14"
4
+ __version__ = "0.0.15"
bioos/errors.py CHANGED
@@ -21,7 +21,7 @@ class EnvironmentConfigurationError(ConfigurationError):
21
21
 
22
22
  def __init__(self, env: str):
23
23
  """Initialize the EnvironmentConfigurationError .
24
-
24
+
25
25
  :param env: environment name of the configuration
26
26
  :type env: str
27
27
  """
@@ -51,13 +51,16 @@ class ParameterError(Exception):
51
51
  """Exception indicating a required parameter not valid
52
52
  """
53
53
 
54
- def __init__(self, name: str):
54
+ def __init__(self, name: str, msg: str = None):
55
55
  """Initialize the ParameterError .
56
56
 
57
57
  :param name: name of the parameter
58
58
  :type name: str
59
59
  """
60
- self.message = "parameter '{}' invalid / not found".format(name)
60
+ self.name = name
61
+ self.message = f"parameter '{name}' invalid / not found"
62
+ if msg:
63
+ self.message += f": {msg}"
61
64
  super().__init__(self.message)
62
65
 
63
66
 
@@ -417,7 +417,7 @@ class WorkflowResource(metaclass=SingletonType):
417
417
  raise ParameterError("name", name)
418
418
 
419
419
  if language != "WDL":
420
- raise ParameterError("language", language)
420
+ raise ParameterError("language", f"Unsupported language: '{language}'. Only 'WDL' is supported.")
421
421
 
422
422
  if source.startswith("http://") or source.startswith("https://"):
423
423
  params = {
@@ -432,7 +432,50 @@ class WorkflowResource(metaclass=SingletonType):
432
432
  }
433
433
  if token:
434
434
  params["Token"] = token
435
- elif os.path.exists(source):
435
+ return Config.service().create_workflow(params)
436
+ elif os.path.isdir(source):
437
+ # 扫描文件夹中的所有 WDL 文件,并构建相对路径
438
+ # 用 source 来检验上传的是否是文件夹
439
+ source_files = []
440
+ for root, _, files in os.walk(source):
441
+ for file in files:
442
+ if file.endswith('.wdl'):
443
+ full_path = os.path.join(root, file)
444
+ relative_path = os.path.relpath(full_path, source) # 获取文件相对于source的相对路径。
445
+ source_files.append({
446
+ "name": relative_path, # 使用相对路径
447
+ "originFile": open(full_path, "rb").read()
448
+ })
449
+
450
+ if not source_files:
451
+ raise ParameterError("source", "No WDL files found in the specified folder")
452
+
453
+ # 确保主工作流路径是相对路径
454
+ if main_workflow_path:
455
+ if not os.path.exists(main_workflow_path):
456
+ raise ParameterError("main_workflow_path", f"Main workflow file {main_workflow_path} not found")
457
+ main_relative = os.path.relpath(main_workflow_path, source)
458
+ else:
459
+ main_relative = None
460
+
461
+ zip_base64 = zip_files(source_files, "base64")
462
+
463
+ params = {
464
+ "WorkspaceID": self.workspace_id,
465
+ "Name": name,
466
+ "Description": description,
467
+ "Language": language,
468
+ "SourceType": "file",
469
+ "Content": zip_base64,
470
+ }
471
+ if main_relative:
472
+ params["MainWorkflowPath"] = os.path.basename(main_relative)
473
+ if token:
474
+ params["Token"] = token
475
+
476
+ return Config.service().create_workflow(params)
477
+ #单文件上传
478
+ elif os.path.isfile(source) and source.endswith('.wdl'):
436
479
  source_files = [{
437
480
  "name": os.path.basename(source),
438
481
  "originFile": open(source, "rb").read()
@@ -450,10 +493,9 @@ class WorkflowResource(metaclass=SingletonType):
450
493
  "Content": zip_base64,
451
494
  "MainWorkflowPath": main_workflow_path,
452
495
  }
496
+ return Config.service().create_workflow(params)
453
497
  else:
454
- raise ParameterError("source", source)
455
-
456
- return Config.service().create_workflow(params)
498
+ raise ParameterError("source",f"Workflow source '{source}' does not exist.")
457
499
 
458
500
  def list(self) -> DataFrame:
459
501
  """Lists all workflows' information .
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybioos
3
- Version: 0.0.14
3
+ Version: 0.0.15
4
4
  Summary: BioOS SDK for Python
5
5
  Home-page: https://github.com/GBA-BI/pybioos
6
6
  Author: Jilong Liu
@@ -1,4 +1,4 @@
1
- bioos/__about__.py,sha256=ev5P6FQdPx-W_Hkam384TBq5XWIMHrvDeSBRkz-p7wo,57
1
+ bioos/__about__.py,sha256=zsL_PukbnoBYjoIOAjFEp5bxiw0QpluTLypKg_3j1mw,57
2
2
  bioos/__init__.py,sha256=4GZKi13lDTD25YBkGakhZyEQZWTER_OWQMNPoH_UM2c,22
3
3
  bioos/bioos.py,sha256=fHzOb1l5wYxw6NVYYZDiFcgk4V28BAgWEc3ev12reWs,2409
4
4
  bioos/bioos_workflow.py,sha256=BzEPOyAjgdK7Wafbl2b1_qG_VTEdp8xDwKS68tBovjs,14327
@@ -6,7 +6,7 @@ bioos/bw_import.py,sha256=lQk_ch_tTz8l4bnWniOzWZ1IxI6ZvKlaASkNMsdDGfA,5697
6
6
  bioos/bw_import_status_check.py,sha256=sJuso2SAfZWvPzypnGge25Ayv5PsSGRXqSNNwIhNu-E,2794
7
7
  bioos/bw_status_check.py,sha256=FVilkawRA7GD1JXUBeaR28W1DfN9bAzYBIAjqi4JIno,2916
8
8
  bioos/config.py,sha256=CvFabYqV1BkFWO8fnr5vBf6xNtNzA8hAEVeEIbvAOm8,4307
9
- bioos/errors.py,sha256=Lzz2rkjDOTR2X9CnVkmsmqeOgmNqbi46WAxnC6LEGm0,2459
9
+ bioos/errors.py,sha256=p0fH6JSMYBjul88lMJ7PPwGNh4SYg62-7VMNuUXWl-E,2540
10
10
  bioos/get_submission_logs.py,sha256=jUtT8Vic8h_VOcqrqJsTBSonve64RjbKNAyp0wUtIpg,3934
11
11
  bioos/log.py,sha256=twiCvf5IgJB7uvzANwBluSlztJN8ZrxbGZUBGlZ0vps,3204
12
12
  bioos/internal/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -17,7 +17,7 @@ bioos/resource/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
17
  bioos/resource/data_models.py,sha256=enKp8yyQI8IbRqe--0Xtyg1XzOwQQPQzoQsx_hNuZ6E,5089
18
18
  bioos/resource/files.py,sha256=1HY0IHvq8H843VM2XZIHDdCuXXNcMrlEFhSNqWXmFzE,8456
19
19
  bioos/resource/utility.py,sha256=emY7qVLLLvGmQYlVj-_bLAxU7i1GfQOUybdRkfEDwVA,1300
20
- bioos/resource/workflows.py,sha256=DUAwq0AE7FZbnb5iJUGEKC5XzGFl_CcJy7Sh0KO-EvM,21387
20
+ bioos/resource/workflows.py,sha256=v2jTAEBhVjp4U-iLaIswYBMkHZ7uQ96dZUE0zvjnrWQ,23426
21
21
  bioos/resource/workspaces.py,sha256=Gmr8y_sjK7TQbhMhQ_7rxqR1KFcwU72I95YYCFrrLBQ,3995
22
22
  bioos/service/BioOsService.py,sha256=HuYUEwomHCLpA1MYgVqGyWAQWHM-_BHB-jmy9VsOlnQ,6724
23
23
  bioos/service/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -34,9 +34,9 @@ bioos/tests/workspaces.py,sha256=LuuRrTs2XqfE5mGQyJNl9RBtuMb4NZHBJFoO8HMZVYQ,522
34
34
  bioos/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  bioos/utils/common_tools.py,sha256=fgMoE_-qZjgfQtUj_pmCTyYDtbJasyfH4Gm3VQsbgBQ,1651
36
36
  bioos/utils/workflows.py,sha256=zRbwTUigoM5V5LFOgzQPm3kwxt5Ogz95OFfefJc6Fjo,133
37
- pybioos-0.0.14.dist-info/LICENSE,sha256=cPkGXsgfPgEhIns7Lt3Avxx0Uy-VbdsoP8jvNGuj3cE,1063
38
- pybioos-0.0.14.dist-info/METADATA,sha256=8sh0iBOI-33lr0H0_q6ZOzznns9i46p16siJFcRbnrM,830
39
- pybioos-0.0.14.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
40
- pybioos-0.0.14.dist-info/entry_points.txt,sha256=Sc5H0_X7r03Mef4Qd70bebqgdIbVAxLU7nV7qP7cKD4,328
41
- pybioos-0.0.14.dist-info/top_level.txt,sha256=llpzydkKVDSaWZgz3bsTUsQmhoQpc_JcRJg2-H-5a2U,6
42
- pybioos-0.0.14.dist-info/RECORD,,
37
+ pybioos-0.0.15.dist-info/LICENSE,sha256=cPkGXsgfPgEhIns7Lt3Avxx0Uy-VbdsoP8jvNGuj3cE,1063
38
+ pybioos-0.0.15.dist-info/METADATA,sha256=mtaPib2vulNih35eFfmzWcpz8sdMHOWjZ-IYYwxqHDE,830
39
+ pybioos-0.0.15.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
40
+ pybioos-0.0.15.dist-info/entry_points.txt,sha256=Sc5H0_X7r03Mef4Qd70bebqgdIbVAxLU7nV7qP7cKD4,328
41
+ pybioos-0.0.15.dist-info/top_level.txt,sha256=llpzydkKVDSaWZgz3bsTUsQmhoQpc_JcRJg2-H-5a2U,6
42
+ pybioos-0.0.15.dist-info/RECORD,,