pybiolib 1.2.494__py3-none-any.whl → 1.2.500__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.
- biolib/_internal/types/resource.py +4 -0
 - biolib/experiments/experiment.py +6 -6
 - biolib/jobs/job.py +13 -0
 - {pybiolib-1.2.494.dist-info → pybiolib-1.2.500.dist-info}/METADATA +1 -1
 - {pybiolib-1.2.494.dist-info → pybiolib-1.2.500.dist-info}/RECORD +8 -8
 - {pybiolib-1.2.494.dist-info → pybiolib-1.2.500.dist-info}/LICENSE +0 -0
 - {pybiolib-1.2.494.dist-info → pybiolib-1.2.500.dist-info}/WHEEL +0 -0
 - {pybiolib-1.2.494.dist-info → pybiolib-1.2.500.dist-info}/entry_points.txt +0 -0
 
| 
         @@ -9,6 +9,10 @@ class ResourceDict(TypedDict): 
     | 
|
| 
       9 
9 
     | 
    
         
             
                uri: str
         
     | 
| 
       10 
10 
     | 
    
         
             
                name: str
         
     | 
| 
       11 
11 
     | 
    
         
             
                created_at: str
         
     | 
| 
      
 12 
     | 
    
         
            +
                description: str
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            class ResourceDetailedDict(ResourceDict):
         
     | 
| 
       12 
16 
     | 
    
         
             
                app: Optional[AppSlimDict]
         
     | 
| 
       13 
17 
     | 
    
         
             
                data_record: Optional[DataRecordSlimDict]
         
     | 
| 
       14 
18 
     | 
    
         
             
                experiment: Optional[ExperimentSlimDict]
         
     | 
    
        biolib/experiments/experiment.py
    CHANGED
    
    | 
         @@ -22,8 +22,8 @@ class Experiment: 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    }
         
     | 
| 
       23 
23 
     | 
    
         
             
                )
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                def __init__(self, uri: str, _resource_dict: Optional[_types. 
     | 
| 
       26 
     | 
    
         
            -
                    self._resource_dict: _types. 
     | 
| 
      
 25 
     | 
    
         
            +
                def __init__(self, uri: str, _resource_dict: Optional[_types.ResourceDetailedDict] = None):
         
     | 
| 
      
 26 
     | 
    
         
            +
                    self._resource_dict: _types.ResourceDetailedDict = _resource_dict or self._get_or_create_resource_dict(uri)
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                def __enter__(self):
         
     | 
| 
       29 
29 
     | 
    
         
             
                    Experiment._BIOLIB_EXPERIMENTS.append(self)
         
     | 
| 
         @@ -75,7 +75,7 @@ class Experiment: 
     | 
|
| 
       75 
75 
     | 
    
         
             
                @staticmethod
         
     | 
| 
       76 
76 
     | 
    
         
             
                def get_by_uri(uri: str) -> 'Experiment':
         
     | 
| 
       77 
77 
     | 
    
         
             
                    query_param_key = 'uri' if '/' in uri else 'name'
         
     | 
| 
       78 
     | 
    
         
            -
                    resource_dict: _types. 
     | 
| 
      
 78 
     | 
    
         
            +
                    resource_dict: _types.ResourceDetailedDict = api.client.get('/resource/', params={query_param_key: uri}).json()
         
     | 
| 
       79 
79 
     | 
    
         
             
                    if not resource_dict['experiment']:
         
     | 
| 
       80 
80 
     | 
    
         
             
                        raise ValueError(f'Resource {uri} is not an experiment')
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
         @@ -197,15 +197,15 @@ class Experiment: 
     | 
|
| 
       197 
197 
     | 
    
         
             
                    self._refetch()
         
     | 
| 
       198 
198 
     | 
    
         | 
| 
       199 
199 
     | 
    
         
             
                @staticmethod
         
     | 
| 
       200 
     | 
    
         
            -
                def _get_resource_dict_by_uuid(uuid: str) -> _types. 
     | 
| 
       201 
     | 
    
         
            -
                    resource_dict: _types. 
     | 
| 
      
 200 
     | 
    
         
            +
                def _get_resource_dict_by_uuid(uuid: str) -> _types.ResourceDetailedDict:
         
     | 
| 
      
 201 
     | 
    
         
            +
                    resource_dict: _types.ResourceDetailedDict = api.client.get(f'/resources/{uuid}/').json()
         
     | 
| 
       202 
202 
     | 
    
         
             
                    if not resource_dict['experiment']:
         
     | 
| 
       203 
203 
     | 
    
         
             
                        raise ValueError('Resource from URI is not an experiment')
         
     | 
| 
       204 
204 
     | 
    
         | 
| 
       205 
205 
     | 
    
         
             
                    return resource_dict
         
     | 
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
                @staticmethod
         
     | 
| 
       208 
     | 
    
         
            -
                def _get_or_create_resource_dict(uri: str) -> _types. 
     | 
| 
      
 208 
     | 
    
         
            +
                def _get_or_create_resource_dict(uri: str) -> _types.ResourceDetailedDict:
         
     | 
| 
       209 
209 
     | 
    
         
             
                    response_dict = api.client.post(path='/experiments/', data={'uri' if '/' in uri else 'name': uri}).json()
         
     | 
| 
       210 
210 
     | 
    
         
             
                    return Experiment._get_resource_dict_by_uuid(uuid=response_dict['uuid'])
         
     | 
| 
       211 
211 
     | 
    
         | 
    
        biolib/jobs/job.py
    CHANGED
    
    | 
         @@ -217,6 +217,19 @@ class Job: 
     | 
|
| 
       217 
217 
     | 
    
         
             
                    except Exception as error:
         
     | 
| 
       218 
218 
     | 
    
         
             
                        logger.error(f'Failed to cancel job {self._uuid} due to: {error}')
         
     | 
| 
       219 
219 
     | 
    
         | 
| 
      
 220 
     | 
    
         
            +
                def rename(self, name: str) -> None:
         
     | 
| 
      
 221 
     | 
    
         
            +
                    try:
         
     | 
| 
      
 222 
     | 
    
         
            +
                        api.client.patch(
         
     | 
| 
      
 223 
     | 
    
         
            +
                            path=f'/jobs/{self._uuid}/main_result/',
         
     | 
| 
      
 224 
     | 
    
         
            +
                            headers={'Job-Auth-Token': self._auth_token} if self._auth_token else None,
         
     | 
| 
      
 225 
     | 
    
         
            +
                            data={'result_name_prefix': name},
         
     | 
| 
      
 226 
     | 
    
         
            +
                        )
         
     | 
| 
      
 227 
     | 
    
         
            +
                        self._refetch_job_dict(force_refetch=True)
         
     | 
| 
      
 228 
     | 
    
         
            +
                        updated_name = self.get_name()
         
     | 
| 
      
 229 
     | 
    
         
            +
                        logger.info(f'Job {self._uuid} renamed to "{updated_name}"')
         
     | 
| 
      
 230 
     | 
    
         
            +
                    except Exception as error:
         
     | 
| 
      
 231 
     | 
    
         
            +
                        raise BioLibError(f'Failed to rename job {self._uuid} due to: {error}') from error
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
       220 
233 
     | 
    
         
             
                def recompute(self, app_uri: Optional[str] = None, machine: Optional[str] = None, blocking: bool = True) -> 'Job':
         
     | 
| 
       221 
234 
     | 
    
         
             
                    app_response = BiolibAppApi.get_by_uri(uri=app_uri or self._job_dict['app_uri'])
         
     | 
| 
       222 
235 
     | 
    
         | 
| 
         @@ -20,7 +20,7 @@ biolib/_internal/types/app.py,sha256=Mz2QGD_jESX-K9JYnLWPo4YA__Q_1FQQTk9pvidCohU 
     | 
|
| 
       20 
20 
     | 
    
         
             
            biolib/_internal/types/data_record.py,sha256=9r_vdhVs60YTnzU4XQFXfDrfS2P2MqD3BH2xa7lk6ck,852
         
     | 
| 
       21 
21 
     | 
    
         
             
            biolib/_internal/types/experiment.py,sha256=D94iBdn2nS92lRW-TOs1a2WKXJD5ZtmzL4ypggKX2ys,176
         
     | 
| 
       22 
22 
     | 
    
         
             
            biolib/_internal/types/file_node.py,sha256=T6BIqo662f3nwMBRqtBHYsg6YuuUaKpiokHcVjv9_ME,283
         
     | 
| 
       23 
     | 
    
         
            -
            biolib/_internal/types/resource.py,sha256= 
     | 
| 
      
 23 
     | 
    
         
            +
            biolib/_internal/types/resource.py,sha256=uUI9Rt5ehkXv9NEDW9zsaPXiTXxnj811rSUW3g_joJw,437
         
     | 
| 
       24 
24 
     | 
    
         
             
            biolib/_internal/types/resource_version.py,sha256=sLxViYXloDDUhTDFgjegiQCj097OM1Ih1-uqlC_4ULA,174
         
     | 
| 
       25 
25 
     | 
    
         
             
            biolib/_internal/types/typing.py,sha256=D4EKKEe7kDx0K6lJi-H_XLtk-8w6nu2fdqn9bvzI-Xo,288
         
     | 
| 
       26 
26 
     | 
    
         
             
            biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
         
     | 
| 
         @@ -99,9 +99,9 @@ biolib/compute_node/webserver/webserver_types.py,sha256=2t8EaFKESnves3BA_NBdnS2y 
     | 
|
| 
       99 
99 
     | 
    
         
             
            biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
         
     | 
| 
       100 
100 
     | 
    
         
             
            biolib/compute_node/webserver/worker_thread.py,sha256=7uD9yQPhePYvP2HCJ27EeZ_h6psfIWFgqm1RHZxzobs,12483
         
     | 
| 
       101 
101 
     | 
    
         
             
            biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       102 
     | 
    
         
            -
            biolib/experiments/experiment.py,sha256= 
     | 
| 
      
 102 
     | 
    
         
            +
            biolib/experiments/experiment.py,sha256=muX5lKH18ZChCLpd3TCikgi0QSEaaV0BZ3vYCLSf3G8,8607
         
     | 
| 
       103 
103 
     | 
    
         
             
            biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
         
     | 
| 
       104 
     | 
    
         
            -
            biolib/jobs/job.py,sha256= 
     | 
| 
      
 104 
     | 
    
         
            +
            biolib/jobs/job.py,sha256=edKfRiojv6f4sLzz1YfJupwvHL2zuh7L_2v_3a4gSCI,21456
         
     | 
| 
       105 
105 
     | 
    
         
             
            biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
         
     | 
| 
       106 
106 
     | 
    
         
             
            biolib/jobs/types.py,sha256=ezvaoTANsWazK6PmfpYcqezdfjP7MNBEBfqIZGoZhz8,997
         
     | 
| 
       107 
107 
     | 
    
         
             
            biolib/runtime/__init__.py,sha256=MlRepA11n2H-3plB5rzWyyHK2JmP6PiaP3i6x3vt0mg,506
         
     | 
| 
         @@ -118,8 +118,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3 
     | 
|
| 
       118 
118 
     | 
    
         
             
            biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
         
     | 
| 
       119 
119 
     | 
    
         
             
            biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
         
     | 
| 
       120 
120 
     | 
    
         
             
            biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
         
     | 
| 
       121 
     | 
    
         
            -
            pybiolib-1.2. 
     | 
| 
       122 
     | 
    
         
            -
            pybiolib-1.2. 
     | 
| 
       123 
     | 
    
         
            -
            pybiolib-1.2. 
     | 
| 
       124 
     | 
    
         
            -
            pybiolib-1.2. 
     | 
| 
       125 
     | 
    
         
            -
            pybiolib-1.2. 
     | 
| 
      
 121 
     | 
    
         
            +
            pybiolib-1.2.500.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
         
     | 
| 
      
 122 
     | 
    
         
            +
            pybiolib-1.2.500.dist-info/METADATA,sha256=U-N69p_tKgKOouSMw6aQxhQbbVUOri7NF5T3n4MXXG0,1570
         
     | 
| 
      
 123 
     | 
    
         
            +
            pybiolib-1.2.500.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
         
     | 
| 
      
 124 
     | 
    
         
            +
            pybiolib-1.2.500.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
         
     | 
| 
      
 125 
     | 
    
         
            +
            pybiolib-1.2.500.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |