def extract_experiment_output(self, experiment, data): try: return self._upload_tar_data( experiment=experiment, api_method=self.backend_swagger_client.api.uploadExperimentOutputAsTarstream, data=data ) except HTTPError as e: if e.response.status_code == NOT_FOUND: # pylint: disable=protected-access raise ExperimentNotFound( experiment_short_id=experiment.id, project_qualified_name=experiment._project.full_id) if e.response.status_code == UNPROCESSABLE_ENTITY and ( extract_response_field(e.response, 'type') == 'LIMIT_OF_STORAGE_IN_PROJECT_REACHED'): raise StorageLimitReached() raise
def upload_experiment_output(self, experiment, data): try: # Api exception handling is done in _upload_loop self._upload_loop(partial(self._upload_raw_data, api_method=self.backend_swagger_client.api.uploadExperimentOutput), data=data, path_params={'experimentId': experiment.internal_id}, query_params={}) except HTTPError as e: if e.response.status_code == NOT_FOUND: # pylint: disable=protected-access raise ExperimentNotFound( experiment_short_id=experiment.id, project_qualified_name=experiment._project.full_id) if e.response.status_code == UNPROCESSABLE_ENTITY and ( extract_response_field(e.response, 'type') == 'LIMIT_OF_STORAGE_IN_PROJECT_REACHED'): raise StorageLimitReached() raise
def extract_experiment_output(self, experiment, data): try: return self._upload_tar_data( experiment=experiment, api_method=self.backend_swagger_client.api. uploadExperimentOutputAsTarstream, data=data) except HTTPNotFound: # pylint: disable=protected-access raise ExperimentNotFound( experiment_short_id=experiment.id, project_qualified_name=experiment._project_full_id) except HTTPUnprocessableEntity as e: if extract_response_field( e.response, 'type') == 'LIMIT_OF_STORAGE_IN_PROJECT_REACHED': raise StorageLimitReached() else: raise
def handler(*args, **kwargs): experiment = kwargs.get("experiment") if experiment is None: raise NeptuneException( "This function must be called with experiment passed by name," " like this fun(..., experiment=<experiment>, ...)" ) try: return f(*args, **kwargs) except HTTPError as e: if e.response.status_code == NOT_FOUND: # pylint: disable=protected-access raise ExperimentNotFound( experiment_short_id=experiment.id, project_qualified_name=experiment._project.full_id, ) if ( e.response.status_code == UNPROCESSABLE_ENTITY and extract_response_field(e.response, "title").startswith( "Storage limit reached in organization: " ) ): raise StorageLimitReached() raise