pybiolib 1.1.1608__tar.gz → 1.1.1629__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 (105) hide show
  1. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/PKG-INFO +1 -1
  2. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/api/__init__.py +1 -1
  3. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/api/client.py +1 -1
  4. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/api_client.py +19 -21
  5. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/utils.py +2 -2
  6. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/executors/docker_executor.py +31 -3
  7. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/jobs/job.py +7 -2
  8. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/pyproject.toml +1 -1
  9. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/LICENSE +0 -0
  10. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/README.md +0 -0
  11. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/__init__.py +0 -0
  12. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/_internal/__init__.py +0 -0
  13. {pybiolib-1.1.1608/biolib/api → pybiolib-1.1.1629/biolib/_internal}/http_client.py +0 -0
  14. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/_internal/push_application.py +0 -0
  15. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/app/__init__.py +0 -0
  16. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/app/app.py +0 -0
  17. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/app/search_apps.py +0 -0
  18. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/__init__.py +0 -0
  19. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/app_types.py +0 -0
  20. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/auth.py +0 -0
  21. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/biolib_account_api.py +0 -0
  22. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/biolib_app_api.py +0 -0
  23. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/biolib_job_api.py +0 -0
  24. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/biolib_large_file_system_api.py +0 -0
  25. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/common_types.py +0 -0
  26. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/job_types.py +0 -0
  27. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/lfs_types.py +0 -0
  28. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_api_client/user_state.py +0 -0
  29. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/__init__.py +0 -0
  30. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/base_bbf_package.py +0 -0
  31. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/file_in_container.py +0 -0
  32. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/module_input.py +0 -0
  33. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/module_output_v2.py +0 -0
  34. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/remote_endpoints.py +0 -0
  35. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/remote_stream_seeker.py +0 -0
  36. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/saved_job.py +0 -0
  37. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/stdout_and_stderr.py +0 -0
  38. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/system_exception.py +0 -0
  39. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_binary_format/system_status_update.py +0 -0
  40. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_docker_client/__init__.py +0 -0
  41. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_download_container.py +0 -0
  42. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_errors.py +0 -0
  43. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/biolib_logging.py +0 -0
  44. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/__init__.py +0 -0
  45. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/download_container.py +0 -0
  46. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/init.py +0 -0
  47. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/lfs.py +0 -0
  48. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/push.py +0 -0
  49. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/run.py +0 -0
  50. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/runtime.py +0 -0
  51. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/cli/start.py +0 -0
  52. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/.gitignore +0 -0
  53. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/__init__.py +0 -0
  54. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/cloud_utils/__init__.py +0 -0
  55. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/cloud_utils/cloud_utils.py +0 -0
  56. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/__init__.py +0 -0
  57. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/cache_state.py +0 -0
  58. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/cache_types.py +0 -0
  59. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/docker_image_cache.py +0 -0
  60. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/executors/__init__.py +0 -0
  61. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/executors/docker_types.py +0 -0
  62. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/executors/tars/__init__.py +0 -0
  63. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/executors/types.py +0 -0
  64. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/job_legacy_input_wait_timeout_thread.py +0 -0
  65. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/job_max_runtime_timer_thread.py +0 -0
  66. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/job_storage.py +0 -0
  67. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/job_worker.py +0 -0
  68. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/large_file_system.py +0 -0
  69. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/mappings.py +0 -0
  70. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/utilization_reporter_thread.py +0 -0
  71. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/job_worker/utils.py +0 -0
  72. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/remote_host_proxy.py +0 -0
  73. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/socker_listener_thread.py +0 -0
  74. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/socket_sender_thread.py +0 -0
  75. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/utils.py +0 -0
  76. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/__init__.py +0 -0
  77. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/gunicorn_flask_application.py +0 -0
  78. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/webserver.py +0 -0
  79. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/webserver_types.py +0 -0
  80. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/webserver_utils.py +0 -0
  81. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/compute_node/webserver/worker_thread.py +0 -0
  82. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/experiments/__init__.py +0 -0
  83. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/experiments/experiment.py +0 -0
  84. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/experiments/types.py +0 -0
  85. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/jobs/__init__.py +0 -0
  86. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/jobs/job_result.py +0 -0
  87. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/jobs/types.py +0 -0
  88. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/lfs/__init__.py +0 -0
  89. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/lfs/cache.py +0 -0
  90. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/lfs/utils.py +0 -0
  91. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/runtime/__init__.py +0 -0
  92. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/runtime/results.py +0 -0
  93. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/sdk/__init__.py +0 -0
  94. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/tables.py +0 -0
  95. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/templates/__init__.py +0 -0
  96. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/templates/example_app.py +0 -0
  97. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/typing_utils.py +0 -0
  98. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/user/__init__.py +0 -0
  99. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/user/sign_in.py +0 -0
  100. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/__init__.py +0 -0
  101. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/app_uri.py +0 -0
  102. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/cache_state.py +0 -0
  103. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/multipart_uploader.py +0 -0
  104. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/seq_util.py +0 -0
  105. {pybiolib-1.1.1608 → pybiolib-1.1.1629}/biolib/utils/zip/remote_zip.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.1608
3
+ Version: 1.1.1629
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
+ from biolib._internal.http_client import HttpClient
1
2
  from .client import ApiClient as _ApiClient
2
- from .http_client import HttpClient
3
3
 
4
4
  _client = _ApiClient()
5
5
  client = _client
@@ -2,7 +2,7 @@ from urllib.parse import urljoin, urlencode
2
2
 
3
3
  from biolib.typing_utils import Dict, Optional, Union
4
4
  from biolib.biolib_api_client import BiolibApiClient as DeprecatedApiClient
5
- from .http_client import HttpResponse, HttpClient
5
+ from biolib._internal.http_client import HttpResponse, HttpClient
6
6
 
7
7
  OptionalHeaders = Optional[Dict[str, Union[str, None]]]
8
8
 
@@ -6,7 +6,7 @@ import os
6
6
  from datetime import datetime, timezone
7
7
  from json.decoder import JSONDecodeError
8
8
 
9
- import requests
9
+ from biolib._internal.http_client import HttpClient
10
10
  from biolib.typing_utils import Optional
11
11
  from biolib.biolib_errors import BioLibError
12
12
  from biolib.biolib_logging import logger, logger_no_user_data
@@ -67,20 +67,19 @@ class _ApiClient:
67
67
  return
68
68
 
69
69
  # TODO: Implement nicer error handling
70
- response = requests.post(
71
- url=f'{self.base_url}/api/user/token/refresh/',
72
- timeout=5,
73
- json={'refresh': self.refresh_token},
74
- )
70
+ try:
71
+ response = HttpClient.request(method='POST',
72
+ url=f'{self.base_url}/api/user/token/refresh/',
73
+ data={'refresh': self.refresh_token})
74
+ except Exception as exception:
75
+ logger.error('Sign in with refresh token failed')
76
+ raise exception
77
+
75
78
  try:
76
79
  response_dict = response.json()
77
80
  except JSONDecodeError as error:
78
81
  logger.error('Could not decode response from server as JSON:')
79
82
  raise BioLibError(response.text) from error
80
- if not response.ok:
81
- error_message = f'Sign in with refresh token failed: {response_dict.get("detail")}'
82
- logger.error(error_message)
83
- raise BioLibError(error_message)
84
83
 
85
84
  self.access_token = response_dict['access']
86
85
 
@@ -111,22 +110,21 @@ class _ApiClient:
111
110
 
112
111
  def sign_in_with_api_token(self, api_token: str) -> None:
113
112
  logger_no_user_data.debug('ApiClient: Signing in with BIOLIB_TOKEN...')
114
- response = requests.post(
115
- url=f'{self.base_url}/api/user/api_tokens/exchange/',
116
- json={'token': api_token},
117
- timeout=5,
118
- )
113
+ try:
114
+ response = HttpClient.request(method='POST',
115
+ url=f'{self.base_url}/api/user/api_tokens/exchange/',
116
+ data={'token': api_token})
117
+ except Exception as exception:
118
+ logger.error('Sign in with API token failed')
119
+ raise exception
119
120
  try:
120
121
  json_response = response.json()
121
122
  except JSONDecodeError as error:
122
123
  logger.error('Could not decode response from server as JSON')
123
124
  raise BioLibError(response.text) from error
124
- if not response.ok:
125
- logger.error('Sign in with API token failed')
126
- raise BioLibError(json_response['detail'])
127
- else:
128
- self.access_token = json_response['access_token']
129
- self.refresh_token = json_response['refresh_token']
125
+
126
+ self.access_token = json_response['access_token']
127
+ self.refresh_token = json_response['refresh_token']
130
128
 
131
129
  @staticmethod
132
130
  def _decode_jwt_without_checking_signature(jwt: str) -> Dict[str, Any]:
@@ -1,7 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  import io
3
3
 
4
- import biolib.api
4
+ from biolib._internal.http_client import HttpClient
5
5
 
6
6
 
7
7
  class RemoteEndpoint(ABC):
@@ -77,7 +77,7 @@ class RemoteIndexableBuffer(IndexableBuffer):
77
77
  return bytes(0)
78
78
 
79
79
  end = start + length - 1
80
- response = biolib.api.HttpClient.request(
80
+ response = HttpClient.request(
81
81
  url=self._endpoint.get_remote_url(),
82
82
  headers={'range': f'bytes={start}-{end}'},
83
83
  )
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import subprocess
2
3
  import tempfile
3
4
  import time
4
5
  import tarfile
@@ -490,6 +491,34 @@ class DockerExecutor:
490
491
  self._send_system_exception,
491
492
  ) from exception
492
493
 
494
+ def _get_container_upper_dir_path(self) -> Optional[str]:
495
+ data = self._container.attrs['GraphDriver']['Data']
496
+ upper_dir: Optional[str] = data['UpperDir'] if data else None
497
+
498
+ if not upper_dir and utils.IS_RUNNING_IN_CLOUD:
499
+ # Get upperdir from containerd ctr CLI
500
+ result = subprocess.run(
501
+ args=[
502
+ 'ctr',
503
+ '--namespace', 'moby',
504
+ 'snapshots',
505
+ '--snapshotter', 'nydus',
506
+ 'mounts',
507
+ '/some_arbitrary_path',
508
+ str(self._container.id),
509
+ ],
510
+ check=False,
511
+ capture_output=True,
512
+ )
513
+ if result.returncode == 0:
514
+ match = re.search(r'upperdir=([^,]+)', result.stdout.decode('utf-8'))
515
+ upper_dir = match.group(1) if match else None
516
+
517
+ if upper_dir and os.path.exists(upper_dir):
518
+ return upper_dir
519
+
520
+ return None
521
+
493
522
  def _get_changed_files_in_docker_container(self, pre_start_diff: List[Dict]) -> List[FileInContainer]:
494
523
  from_mappings = [mapping['from_path'] for mapping in self._options['module']['output_files_mappings']]
495
524
  pre_start_diff_paths = [obj['Path'] for obj in pre_start_diff]
@@ -516,11 +545,10 @@ class DockerExecutor:
516
545
  return True
517
546
  return False
518
547
 
519
- data = self._container.attrs['GraphDriver']['Data']
520
- overlay_upper_dir_path = data['UpperDir'] if data and os.path.exists(data['UpperDir']) else None
548
+ overlay_upper_dir_path = self._get_container_upper_dir_path()
521
549
  if not overlay_upper_dir_path:
522
550
  logger_no_user_data.debug(
523
- 'Docker Overlay2 UpperDir not available. Falling back to container.get_archive() for file extraction'
551
+ 'Docker UpperDir not available. Falling back to container.get_archive() for file extraction'
524
552
  )
525
553
 
526
554
  logger.debug(f'overlay_upper_dir_path={overlay_upper_dir_path}')
@@ -8,6 +8,7 @@ from urllib.parse import urlparse
8
8
 
9
9
  import requests
10
10
  from biolib import api, utils
11
+ from biolib._internal.http_client import HttpClient
11
12
  from biolib.biolib_api_client.biolib_job_api import BiolibJobApi
12
13
  from biolib.biolib_binary_format import LazyLoadedFile, ModuleOutputV2, ModuleInput, ModuleInputDict
13
14
  from biolib.biolib_binary_format.stdout_and_stderr import StdoutAndStderr
@@ -302,7 +303,9 @@ class Job:
302
303
 
303
304
  def _print_full_logs(self, node_url: str) -> None:
304
305
  try:
305
- response_json = api.HttpClient.request(url=f'{node_url}/v1/job/{self._uuid}/status/?logs=full').json()
306
+ response_json = HttpClient.request(
307
+ url=f'{node_url}/v1/job/{self._uuid}/status/?logs=full'
308
+ ).json()
306
309
  except Exception as error:
307
310
  logger.error(f'Could not get full streamed logs due to: {error}')
308
311
  raise BioLibError from error
@@ -331,7 +334,9 @@ class Job:
331
334
  def _get_job_status_from_compute_node(self, compute_node_url):
332
335
  for _ in range(15):
333
336
  try:
334
- return api.HttpClient.request(url=f'{compute_node_url}/v1/job/{self._uuid}/status/').json()
337
+ return HttpClient.request(
338
+ url=f'{compute_node_url}/v1/job/{self._uuid}/status/'
339
+ ).json()
335
340
  except Exception: # pylint: disable=broad-except
336
341
  cloud_job = self._get_cloud_job()
337
342
  logger.debug("Failed to get status from compute node, retrying...")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pybiolib"
3
- version = "1.1.1608"
3
+ version = "1.1.1629"
4
4
  description = "BioLib Python Client"
5
5
  readme = "README.md"
6
6
  license = "MIT"
File without changes
File without changes