pybiolib 1.2.558__tar.gz → 1.2.565__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.
- {pybiolib-1.2.558 → pybiolib-1.2.565}/PKG-INFO +1 -1
- pybiolib-1.2.565/biolib/__init__.py +338 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/docker_executor.py +2 -10
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/types.py +0 -1
- {pybiolib-1.2.558 → pybiolib-1.2.565}/pyproject.toml +1 -1
- pybiolib-1.2.558/biolib/__init__.py +0 -145
- {pybiolib-1.2.558 → pybiolib-1.2.565}/LICENSE +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/PYPI_README.md +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_data_record/data_record.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/data_record/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/data_record/data_record.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/data_record/push_data.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/data_record/remote_storage_endpoint.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/file_utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/fuse_mount/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/fuse_mount/experiment_fuse_mount.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/http_client.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/lfs/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/lfs/cache.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/libs/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/libs/fusepy/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/push_application.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/runtime.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/app.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/data_record.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/experiment.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/file_node.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/resource.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/resource_version.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/types/typing.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/utils/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/utils/multinode.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_runtime/runtime.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/api/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/api/client.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/app/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/app/app.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/app/search_apps.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/api_client.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/app_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/auth.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/biolib_app_api.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/biolib_job_api.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/common_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/job_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/lfs_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_api_client/user_state.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/base_bbf_package.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/file_in_container.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/module_input.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/module_output_v2.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/remote_endpoints.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/remote_stream_seeker.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/saved_job.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/stdout_and_stderr.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/system_exception.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/system_status_update.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_binary_format/utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_docker_client/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_download_container.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_errors.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/biolib_logging.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/auth.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/data_record.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/download_container.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/init.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/lfs.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/push.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/run.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/runtime.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/cli/start.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/.gitignore +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/cloud_utils/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/cloud_utils/cloud_utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/cache_state.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/cache_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/docker_image_cache.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/docker_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/tars/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/job_legacy_input_wait_timeout_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/job_max_runtime_timer_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/job_storage.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/job_worker.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/large_file_system.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/mappings.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/utilization_reporter_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/remote_host_proxy.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/socker_listener_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/socket_sender_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/gunicorn_flask_application.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/webserver.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/webserver_types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/webserver_utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/worker_thread.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/experiments/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/experiments/experiment.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/jobs/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/jobs/job.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/jobs/job_result.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/jobs/types.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/py.typed +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/runtime/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/sdk/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/tables.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/templates/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/templates/example_app.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/typing_utils.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/user/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/user/sign_in.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/__init__.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/app_uri.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/cache_state.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/multipart_uploader.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/seq_util.py +0 -0
- {pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/utils/zip/remote_zip.py +0 -0
@@ -0,0 +1,338 @@
|
|
1
|
+
# Imports to hide
|
2
|
+
import os
|
3
|
+
from urllib.parse import urlparse as _urlparse
|
4
|
+
|
5
|
+
from biolib import typing_utils as _typing_utils
|
6
|
+
from biolib.app import BioLibApp as _BioLibApp
|
7
|
+
# TODO: Fix ignore of type
|
8
|
+
from biolib.app.search_apps import search_apps # type: ignore
|
9
|
+
from biolib.biolib_errors import BioLibError
|
10
|
+
from biolib.biolib_logging import logger as _logger, logger_no_user_data as _logger_no_user_data
|
11
|
+
from biolib.experiments.experiment import Experiment
|
12
|
+
from biolib.biolib_api_client import BiolibApiClient as _BioLibApiClient, App
|
13
|
+
from biolib.jobs import Job as _Job
|
14
|
+
from biolib import user as _user
|
15
|
+
from biolib.typing_utils import List, Optional, cast as _cast
|
16
|
+
from biolib._data_record.data_record import DataRecord as _DataRecord
|
17
|
+
|
18
|
+
import biolib.api
|
19
|
+
import biolib.app
|
20
|
+
import biolib.cli
|
21
|
+
import biolib.sdk
|
22
|
+
import biolib.utils
|
23
|
+
|
24
|
+
|
25
|
+
# ------------------------------------ Function definitions for public Python API ------------------------------------
|
26
|
+
|
27
|
+
def call_cli() -> None:
|
28
|
+
biolib.cli.cli()
|
29
|
+
|
30
|
+
|
31
|
+
def load(uri: str) -> _BioLibApp:
|
32
|
+
r"""Load a BioLib application by its URI or website URL.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
uri (str): The URI or website URL of the application to load. Can be either:
|
36
|
+
- App URI (e.g., 'biolib/myapp:1.0.0')
|
37
|
+
- Website URL (e.g., 'https://biolib.com/biolib/myapp/')
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
BioLibApp: The loaded application object
|
41
|
+
|
42
|
+
Example::
|
43
|
+
|
44
|
+
>>> # Load by URI
|
45
|
+
>>> app = biolib.load('biolib/myapp:1.0.0')
|
46
|
+
>>> # Load by website URL
|
47
|
+
>>> app = biolib.load('https://biolib.com/biolib/myapp/')
|
48
|
+
>>> result = app.cli('--help')
|
49
|
+
"""
|
50
|
+
return _BioLibApp(uri)
|
51
|
+
|
52
|
+
|
53
|
+
def search(
|
54
|
+
search_query: Optional[str] = None,
|
55
|
+
team: Optional[str] = None,
|
56
|
+
count: int = 100,
|
57
|
+
) -> List[str]:
|
58
|
+
r"""Search for BioLib applications.
|
59
|
+
|
60
|
+
Args:
|
61
|
+
search_query (str, optional): Search query string
|
62
|
+
team (str, optional): Filter by team name
|
63
|
+
count (int): Maximum number of results to return. Defaults to 100.
|
64
|
+
|
65
|
+
Returns:
|
66
|
+
List[str]: List of application URIs matching the search criteria
|
67
|
+
|
68
|
+
Example::
|
69
|
+
|
70
|
+
>>> # Search all apps
|
71
|
+
>>> apps = biolib.search()
|
72
|
+
>>> # Search by query
|
73
|
+
>>> alignment_apps = biolib.search('alignment')
|
74
|
+
>>> # Search team's apps
|
75
|
+
>>> team_apps = biolib.search(team='myteam')
|
76
|
+
"""
|
77
|
+
apps: List[str] = search_apps(search_query, team, count)
|
78
|
+
return apps
|
79
|
+
|
80
|
+
|
81
|
+
def get_job(job_id: str, job_token: Optional[str] = None) -> _Job:
|
82
|
+
r"""Get a job by its ID.
|
83
|
+
|
84
|
+
Args:
|
85
|
+
job_id (str): The UUID of the job to retrieve
|
86
|
+
job_token (str, optional): Authentication token for accessing the job.
|
87
|
+
Only needed for jobs that aren't owned by the current user.
|
88
|
+
|
89
|
+
Returns:
|
90
|
+
Job: The job object
|
91
|
+
|
92
|
+
Example::
|
93
|
+
|
94
|
+
>>> job = biolib.get_job('abc123')
|
95
|
+
>>> # Access shared job
|
96
|
+
>>> job = biolib.get_job('abc123', job_token='xyz789')
|
97
|
+
"""
|
98
|
+
return _Job.create_from_uuid(uuid=job_id, auth_token=job_token)
|
99
|
+
|
100
|
+
|
101
|
+
def get_data_record(uri: str) -> _DataRecord:
|
102
|
+
r"""Get a data record by its URI.
|
103
|
+
|
104
|
+
Args:
|
105
|
+
uri (str): The URI of the data record to retrieve
|
106
|
+
|
107
|
+
Returns:
|
108
|
+
DataRecord: The data record object
|
109
|
+
|
110
|
+
Example::
|
111
|
+
|
112
|
+
>>> record = biolib.get_data_record('biolib/data/sequences:1.0.0')
|
113
|
+
"""
|
114
|
+
return _DataRecord.get_by_uri(uri)
|
115
|
+
|
116
|
+
|
117
|
+
def fetch_jobs(count: int = 25, status: Optional[str] = None) -> List[_Job]:
|
118
|
+
r"""Fetch a list of jobs from the server.
|
119
|
+
|
120
|
+
Args:
|
121
|
+
count (int): Maximum number of jobs to fetch. Defaults to 25.
|
122
|
+
status (str, optional): Filter jobs by status. One of:
|
123
|
+
'in_progress', 'completed', 'failed', 'cancelled'
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
List[Job]: List of job objects matching the criteria
|
127
|
+
|
128
|
+
Example::
|
129
|
+
|
130
|
+
>>> # Get last 10 completed jobs
|
131
|
+
>>> jobs = biolib.fetch_jobs(10, status='completed')
|
132
|
+
>>> # Get last 100 jobs of any status
|
133
|
+
>>> all_jobs = biolib.fetch_jobs(100)
|
134
|
+
"""
|
135
|
+
return _Job.fetch_jobs(count, status)
|
136
|
+
|
137
|
+
|
138
|
+
def fetch_data_records(uri: Optional[str] = None, count: Optional[int] = None) -> List[_DataRecord]:
|
139
|
+
r"""Fetch a list of data records from the server.
|
140
|
+
|
141
|
+
Args:
|
142
|
+
uri (str, optional): Filter records by URI prefix
|
143
|
+
count (int, optional): Maximum number of records to fetch
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
List[DataRecord]: List of data record objects matching the criteria
|
147
|
+
|
148
|
+
Example::
|
149
|
+
|
150
|
+
>>> # Get all records
|
151
|
+
>>> records = biolib.fetch_data_records()
|
152
|
+
>>> # Get records with URI prefix
|
153
|
+
>>> seq_records = biolib.fetch_data_records('biolib/data/sequences')
|
154
|
+
"""
|
155
|
+
return _DataRecord.fetch(uri, count)
|
156
|
+
|
157
|
+
|
158
|
+
def get_experiment(uri: Optional[str] = None, name: Optional[str] = None) -> Experiment:
|
159
|
+
r"""Get an experiment by its URI or name.
|
160
|
+
|
161
|
+
Args:
|
162
|
+
uri (str, optional): The URI of the experiment
|
163
|
+
name (str, optional): The name of the experiment
|
164
|
+
|
165
|
+
Returns:
|
166
|
+
Experiment: The experiment object
|
167
|
+
|
168
|
+
Raises:
|
169
|
+
ValueError: If neither or both uri and name are provided
|
170
|
+
|
171
|
+
Example::
|
172
|
+
|
173
|
+
>>> # Get by URI
|
174
|
+
>>> exp = biolib.get_experiment(uri='biolib/experiments/analysis')
|
175
|
+
>>> # Get by name
|
176
|
+
>>> exp = biolib.get_experiment(name='sequence-analysis')
|
177
|
+
"""
|
178
|
+
if (not uri and not name) or (uri and name):
|
179
|
+
raise ValueError('Must provide either uri or name')
|
180
|
+
|
181
|
+
return Experiment.get_by_uri(uri=_cast(str, uri or name))
|
182
|
+
|
183
|
+
|
184
|
+
def show_jobs(count: int = 25) -> None:
|
185
|
+
r"""Display a table of recent jobs.
|
186
|
+
|
187
|
+
Args:
|
188
|
+
count (int): Maximum number of jobs to display. Defaults to 25.
|
189
|
+
|
190
|
+
Example::
|
191
|
+
|
192
|
+
>>> biolib.show_jobs() # Show last 25 jobs
|
193
|
+
>>> biolib.show_jobs(100) # Show last 100 jobs
|
194
|
+
"""
|
195
|
+
_Job.show_jobs(count=count)
|
196
|
+
|
197
|
+
|
198
|
+
def show_experiments(count: int = 25) -> None:
|
199
|
+
r"""Display a table of experiments.
|
200
|
+
|
201
|
+
Args:
|
202
|
+
count (int): Maximum number of experiments to display. Defaults to 25.
|
203
|
+
|
204
|
+
Example::
|
205
|
+
|
206
|
+
>>> biolib.show_experiments() # Show last 25 experiments
|
207
|
+
>>> biolib.show_experiments(100) # Show last 100 experiments
|
208
|
+
"""
|
209
|
+
Experiment.show_experiments(count=count)
|
210
|
+
|
211
|
+
|
212
|
+
def sign_in() -> None:
|
213
|
+
_user.sign_in()
|
214
|
+
|
215
|
+
|
216
|
+
def sign_out() -> None:
|
217
|
+
_user.sign_out()
|
218
|
+
|
219
|
+
|
220
|
+
def login() -> None:
|
221
|
+
r"""Alias for :func:`sign_in`.
|
222
|
+
|
223
|
+
Example::
|
224
|
+
|
225
|
+
>>> biolib.login() # Same as biolib.sign_in()
|
226
|
+
"""
|
227
|
+
sign_in()
|
228
|
+
|
229
|
+
|
230
|
+
def logout() -> None:
|
231
|
+
r"""Alias for :func:`sign_out`.
|
232
|
+
|
233
|
+
Example::
|
234
|
+
|
235
|
+
>>> biolib.logout() # Same as biolib.sign_out()
|
236
|
+
"""
|
237
|
+
sign_out()
|
238
|
+
|
239
|
+
|
240
|
+
def set_api_base_url(api_base_url: str) -> None:
|
241
|
+
r"""Set the base URL for the BioLib API.
|
242
|
+
|
243
|
+
Args:
|
244
|
+
api_base_url (str): The base URL for the BioLib API
|
245
|
+
|
246
|
+
Example::
|
247
|
+
|
248
|
+
>>> biolib.set_api_base_url('https://biolib.com')
|
249
|
+
|
250
|
+
Note:
|
251
|
+
This will also update related configuration like site hostname
|
252
|
+
and environment flags.
|
253
|
+
"""
|
254
|
+
_BioLibApiClient.initialize(base_url=api_base_url)
|
255
|
+
biolib.utils.BIOLIB_BASE_URL = api_base_url
|
256
|
+
biolib.utils.BIOLIB_SITE_HOSTNAME = _urlparse(api_base_url).hostname
|
257
|
+
biolib.utils.BASE_URL_IS_PUBLIC_BIOLIB = api_base_url.endswith('biolib.com') or (
|
258
|
+
os.environ.get('BIOLIB_ENVIRONMENT_IS_PUBLIC_BIOLIB', '').upper() == 'TRUE'
|
259
|
+
)
|
260
|
+
|
261
|
+
|
262
|
+
def set_base_url(base_url: str) -> None:
|
263
|
+
r"""Alias for :func:`set_api_base_url`.
|
264
|
+
|
265
|
+
Args:
|
266
|
+
base_url (str): The base URL for the BioLib API
|
267
|
+
|
268
|
+
Example::
|
269
|
+
|
270
|
+
>>> biolib.set_base_url('https://biolib.com')
|
271
|
+
"""
|
272
|
+
return set_api_base_url(base_url)
|
273
|
+
|
274
|
+
|
275
|
+
def set_api_token(api_token: str) -> None:
|
276
|
+
r"""Sign in using an API token.
|
277
|
+
|
278
|
+
Args:
|
279
|
+
api_token (str): The API token to authenticate with
|
280
|
+
|
281
|
+
Example::
|
282
|
+
|
283
|
+
>>> biolib.set_api_token('my-api-token')
|
284
|
+
# Signed in using API token
|
285
|
+
"""
|
286
|
+
api_client = _BioLibApiClient.get()
|
287
|
+
api_client.sign_in_with_api_token(api_token)
|
288
|
+
|
289
|
+
|
290
|
+
def set_log_level(level: _typing_utils.Union[str, int]) -> None:
|
291
|
+
r"""Set the logging level for BioLib.
|
292
|
+
|
293
|
+
Args:
|
294
|
+
level (Union[str, int]): The log level to use. Can be a string
|
295
|
+
('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL') or an integer
|
296
|
+
level from the logging module.
|
297
|
+
|
298
|
+
Example::
|
299
|
+
|
300
|
+
>>> biolib.set_log_level('DEBUG') # Enable debug logging
|
301
|
+
>>> biolib.set_log_level('WARNING') # Only show warnings and errors
|
302
|
+
"""
|
303
|
+
_logger.setLevel(level)
|
304
|
+
_logger_no_user_data.setLevel(level)
|
305
|
+
|
306
|
+
|
307
|
+
def _configure_requests_certificates():
|
308
|
+
if os.getenv('REQUESTS_CA_BUNDLE'):
|
309
|
+
if not os.getenv('SSL_CERT_FILE'):
|
310
|
+
# set SSL_CERT_FILE to urllib use same certs
|
311
|
+
os.environ['SSL_CERT_FILE'] = os.getenv('REQUESTS_CA_BUNDLE')
|
312
|
+
return # don't change REQUESTS_CA_BUNDLE if manually configured
|
313
|
+
|
314
|
+
certs_to_check = [
|
315
|
+
'/etc/ssl/certs/ca-certificates.crt',
|
316
|
+
'/etc/pki/tls/certs/ca-bundle.crt',
|
317
|
+
'/etc/ssl/ca-bundle.pem',
|
318
|
+
'/etc/pki/tls/cacert.pem',
|
319
|
+
'/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
|
320
|
+
'/etc/ssl/cert.pem',
|
321
|
+
]
|
322
|
+
|
323
|
+
for cert in certs_to_check:
|
324
|
+
if os.path.exists(cert):
|
325
|
+
os.environ['REQUESTS_CA_BUNDLE'] = cert
|
326
|
+
if not os.getenv('SSL_CERT_FILE'):
|
327
|
+
os.environ['SSL_CERT_FILE'] = cert
|
328
|
+
return
|
329
|
+
|
330
|
+
|
331
|
+
# -------------------------------------------------- Configuration ---------------------------------------------------
|
332
|
+
__version__ = biolib.utils.BIOLIB_PACKAGE_VERSION
|
333
|
+
_DEFAULT_LOG_LEVEL = 'INFO' if biolib.utils.IS_RUNNING_IN_NOTEBOOK else 'WARNING'
|
334
|
+
_logger.configure(default_log_level=_DEFAULT_LOG_LEVEL)
|
335
|
+
_logger_no_user_data.configure(default_log_level=_DEFAULT_LOG_LEVEL)
|
336
|
+
_configure_requests_certificates()
|
337
|
+
|
338
|
+
set_api_base_url(biolib.utils.load_base_url_from_env())
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/docker_executor.py
RENAMED
@@ -201,9 +201,6 @@ class DockerExecutor:
|
|
201
201
|
stream=True,
|
202
202
|
)
|
203
203
|
|
204
|
-
logger_no_user_data.debug(f'Running diff for Docker container for {job_uuid}')
|
205
|
-
pre_start_diff = self._container.diff()
|
206
|
-
|
207
204
|
logger_no_user_data.debug(f'Starting Docker container for {job_uuid}')
|
208
205
|
startup_error_string: Optional[str] = None
|
209
206
|
try:
|
@@ -218,7 +215,6 @@ class DockerExecutor:
|
|
218
215
|
self._metadata_for_save_output_on_cancel = MetadataToSaveOutput(
|
219
216
|
arguments=module_input['arguments'],
|
220
217
|
startup_error_string=startup_error_string,
|
221
|
-
pre_start_diff=pre_start_diff,
|
222
218
|
)
|
223
219
|
|
224
220
|
if self._options['job']['app_version'].get('stdout_render_type') != 'markdown':
|
@@ -264,7 +260,6 @@ class DockerExecutor:
|
|
264
260
|
module_output_path=self._options['module_output_path'],
|
265
261
|
stderr=full_stderr,
|
266
262
|
stdout=full_stdout,
|
267
|
-
pre_start_diff=metadata['pre_start_diff'],
|
268
263
|
)
|
269
264
|
|
270
265
|
def cleanup(self):
|
@@ -532,12 +527,11 @@ class DockerExecutor:
|
|
532
527
|
module_output_path: str,
|
533
528
|
stderr: bytes,
|
534
529
|
stdout: bytes,
|
535
|
-
pre_start_diff: List[Dict],
|
536
530
|
) -> None:
|
537
531
|
mapped_files: List[FileInContainer] = []
|
538
532
|
try:
|
539
533
|
mappings = Mappings(mappings_list=self._options['module']['output_files_mappings'], arguments=arguments)
|
540
|
-
changed_files: List[FileInContainer] = self._get_changed_files_in_docker_container(
|
534
|
+
changed_files: List[FileInContainer] = self._get_changed_files_in_docker_container()
|
541
535
|
|
542
536
|
for file in changed_files:
|
543
537
|
if file.is_file():
|
@@ -602,15 +596,13 @@ class DockerExecutor:
|
|
602
596
|
|
603
597
|
return None
|
604
598
|
|
605
|
-
def _get_changed_files_in_docker_container(self
|
599
|
+
def _get_changed_files_in_docker_container(self) -> List[FileInContainer]:
|
606
600
|
from_mappings = [mapping['from_path'] for mapping in self._options['module']['output_files_mappings']]
|
607
|
-
pre_start_diff_paths = [obj['Path'] for obj in pre_start_diff]
|
608
601
|
post_run_diff = self._container.diff()
|
609
602
|
run_diff_paths: List[str] = [
|
610
603
|
obj['Path']
|
611
604
|
for obj in post_run_diff
|
612
605
|
if obj['Kind'] in (DockerDiffKind.CHANGED.value, DockerDiffKind.ADDED.value)
|
613
|
-
and obj['Path'] not in pre_start_diff_paths
|
614
606
|
]
|
615
607
|
|
616
608
|
known_directories = set()
|
@@ -1,145 +0,0 @@
|
|
1
|
-
# Imports to hide
|
2
|
-
import os
|
3
|
-
from urllib.parse import urlparse as _urlparse
|
4
|
-
|
5
|
-
from biolib import typing_utils as _typing_utils
|
6
|
-
from biolib.app import BioLibApp as _BioLibApp
|
7
|
-
# TODO: Fix ignore of type
|
8
|
-
from biolib.app.search_apps import search_apps # type: ignore
|
9
|
-
from biolib.biolib_errors import BioLibError
|
10
|
-
from biolib.biolib_logging import logger as _logger, logger_no_user_data as _logger_no_user_data
|
11
|
-
from biolib.experiments.experiment import Experiment
|
12
|
-
from biolib.biolib_api_client import BiolibApiClient as _BioLibApiClient, App
|
13
|
-
from biolib.jobs import Job as _Job
|
14
|
-
from biolib import user as _user
|
15
|
-
from biolib.typing_utils import List, Optional, cast as _cast
|
16
|
-
from biolib._data_record.data_record import DataRecord as _DataRecord
|
17
|
-
|
18
|
-
import biolib.api
|
19
|
-
import biolib.app
|
20
|
-
import biolib.cli
|
21
|
-
import biolib.sdk
|
22
|
-
import biolib.utils
|
23
|
-
|
24
|
-
|
25
|
-
# ------------------------------------ Function definitions for public Python API ------------------------------------
|
26
|
-
|
27
|
-
def call_cli() -> None:
|
28
|
-
biolib.cli.cli()
|
29
|
-
|
30
|
-
|
31
|
-
def load(uri: str) -> _BioLibApp:
|
32
|
-
return _BioLibApp(uri)
|
33
|
-
|
34
|
-
|
35
|
-
def search(
|
36
|
-
search_query: Optional[str] = None,
|
37
|
-
team: Optional[str] = None,
|
38
|
-
count: int = 100,
|
39
|
-
) -> List[str]:
|
40
|
-
apps: List[str] = search_apps(search_query, team, count)
|
41
|
-
return apps
|
42
|
-
|
43
|
-
|
44
|
-
def get_job(job_id: str, job_token: Optional[str] = None) -> _Job:
|
45
|
-
return _Job.create_from_uuid(uuid=job_id, auth_token=job_token)
|
46
|
-
|
47
|
-
|
48
|
-
def get_data_record(uri: str) -> _DataRecord:
|
49
|
-
return _DataRecord.get_by_uri(uri)
|
50
|
-
|
51
|
-
|
52
|
-
def fetch_jobs(count: int = 25, status: Optional[str] = None) -> List[_Job]:
|
53
|
-
return _Job.fetch_jobs(count, status)
|
54
|
-
|
55
|
-
|
56
|
-
def fetch_data_records(uri: Optional[str] = None, count: Optional[int] = None) -> List[_DataRecord]:
|
57
|
-
return _DataRecord.fetch(uri, count)
|
58
|
-
|
59
|
-
|
60
|
-
def get_experiment(uri: Optional[str] = None, name: Optional[str] = None) -> Experiment:
|
61
|
-
if (not uri and not name) or (uri and name):
|
62
|
-
raise ValueError('Must provide either uri or name')
|
63
|
-
|
64
|
-
return Experiment.get_by_uri(uri=_cast(str, uri or name))
|
65
|
-
|
66
|
-
|
67
|
-
def show_jobs(count: int = 25) -> None:
|
68
|
-
_Job.show_jobs(count=count)
|
69
|
-
|
70
|
-
|
71
|
-
def show_experiments(count: int = 25) -> None:
|
72
|
-
Experiment.show_experiments(count=count)
|
73
|
-
|
74
|
-
|
75
|
-
def sign_in() -> None:
|
76
|
-
_user.sign_in()
|
77
|
-
|
78
|
-
|
79
|
-
def sign_out() -> None:
|
80
|
-
_user.sign_out()
|
81
|
-
|
82
|
-
|
83
|
-
def login() -> None:
|
84
|
-
sign_in()
|
85
|
-
|
86
|
-
|
87
|
-
def logout() -> None:
|
88
|
-
sign_out()
|
89
|
-
|
90
|
-
|
91
|
-
def set_api_base_url(api_base_url: str) -> None:
|
92
|
-
_BioLibApiClient.initialize(base_url=api_base_url)
|
93
|
-
biolib.utils.BIOLIB_BASE_URL = api_base_url
|
94
|
-
biolib.utils.BIOLIB_SITE_HOSTNAME = _urlparse(api_base_url).hostname
|
95
|
-
biolib.utils.BASE_URL_IS_PUBLIC_BIOLIB = api_base_url.endswith('biolib.com') or (
|
96
|
-
os.environ.get('BIOLIB_ENVIRONMENT_IS_PUBLIC_BIOLIB', '').upper() == 'TRUE'
|
97
|
-
)
|
98
|
-
|
99
|
-
|
100
|
-
def set_base_url(base_url: str) -> None:
|
101
|
-
return set_api_base_url(base_url)
|
102
|
-
|
103
|
-
|
104
|
-
def set_api_token(api_token: str) -> None:
|
105
|
-
api_client = _BioLibApiClient.get()
|
106
|
-
api_client.sign_in_with_api_token(api_token)
|
107
|
-
|
108
|
-
|
109
|
-
def set_log_level(level: _typing_utils.Union[str, int]) -> None:
|
110
|
-
_logger.setLevel(level)
|
111
|
-
_logger_no_user_data.setLevel(level)
|
112
|
-
|
113
|
-
|
114
|
-
def _configure_requests_certificates():
|
115
|
-
if os.getenv('REQUESTS_CA_BUNDLE'):
|
116
|
-
if not os.getenv('SSL_CERT_FILE'):
|
117
|
-
# set SSL_CERT_FILE to urllib use same certs
|
118
|
-
os.environ['SSL_CERT_FILE'] = os.getenv('REQUESTS_CA_BUNDLE')
|
119
|
-
return # don't change REQUESTS_CA_BUNDLE if manually configured
|
120
|
-
|
121
|
-
certs_to_check = [
|
122
|
-
'/etc/ssl/certs/ca-certificates.crt',
|
123
|
-
'/etc/pki/tls/certs/ca-bundle.crt',
|
124
|
-
'/etc/ssl/ca-bundle.pem',
|
125
|
-
'/etc/pki/tls/cacert.pem',
|
126
|
-
'/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
|
127
|
-
'/etc/ssl/cert.pem',
|
128
|
-
]
|
129
|
-
|
130
|
-
for cert in certs_to_check:
|
131
|
-
if os.path.exists(cert):
|
132
|
-
os.environ['REQUESTS_CA_BUNDLE'] = cert
|
133
|
-
if not os.getenv('SSL_CERT_FILE'):
|
134
|
-
os.environ['SSL_CERT_FILE'] = cert
|
135
|
-
return
|
136
|
-
|
137
|
-
|
138
|
-
# -------------------------------------------------- Configuration ---------------------------------------------------
|
139
|
-
__version__ = biolib.utils.BIOLIB_PACKAGE_VERSION
|
140
|
-
_DEFAULT_LOG_LEVEL = 'INFO' if biolib.utils.IS_RUNNING_IN_NOTEBOOK else 'WARNING'
|
141
|
-
_logger.configure(default_log_level=_DEFAULT_LOG_LEVEL)
|
142
|
-
_logger_no_user_data.configure(default_log_level=_DEFAULT_LOG_LEVEL)
|
143
|
-
_configure_requests_certificates()
|
144
|
-
|
145
|
-
set_api_base_url(biolib.utils.load_base_url_from_env())
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/_internal/data_record/remote_storage_endpoint.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/docker_types.py
RENAMED
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/executors/tars/__init__.py
RENAMED
File without changes
|
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/job_max_runtime_timer_thread.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/job_worker/utilization_reporter_thread.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.2.558 → pybiolib-1.2.565}/biolib/compute_node/webserver/gunicorn_flask_application.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|