Beispiel #1
0
 def get_float_series_values(
     self,
     container_id: str,
     container_type: ContainerType,
     path: List[str],
     offset: int,
     limit: int,
 ) -> FloatSeriesValues:
     params = {
         "experimentId": container_id,
         "attribute": path_to_str(path),
         "limit": limit,
         "offset": offset,
         **DEFAULT_REQUEST_KWARGS,
     }
     try:
         result = (
             self.leaderboard_client.api.getFloatSeriesValues(**params)
             .response()
             .result
         )
         return FloatSeriesValues(
             result.totalItemCount,
             [
                 FloatPointValue(v.timestampMillis, v.step, v.value)
                 for v in result.values
             ],
         )
     except HTTPNotFound:
         raise FetchAttributeNotFoundException(path_to_str(path))
Beispiel #2
0
 def get_file_attribute(
     self, container_id: str, container_type: ContainerType, path: List[str]
 ) -> FileAttribute:
     params = {
         "experimentId": container_id,
         "attribute": path_to_str(path),
         **DEFAULT_REQUEST_KWARGS,
     }
     try:
         result = (
             self.leaderboard_client.api.getFileAttribute(**params).response().result
         )
         return FileAttribute(name=result.name, ext=result.ext, size=result.size)
     except HTTPNotFound:
         raise FetchAttributeNotFoundException(path_to_str(path))
Beispiel #3
0
 def get_bool_attribute(
     self, container_id: str, container_type: ContainerType, path: List[str]
 ) -> BoolAttribute:
     params = {
         "experimentId": container_id,
         "attribute": path_to_str(path),
         **DEFAULT_REQUEST_KWARGS,
     }
     try:
         result = (
             self.leaderboard_client.api.getBoolAttribute(**params).response().result
         )
         return BoolAttribute(result.value)
     except HTTPNotFound:
         raise FetchAttributeNotFoundException(path_to_str(path))
Beispiel #4
0
 def _get_file_set_download_request(
     self, container_id: str, container_type: ContainerType, path: List[str]
 ):
     params = {
         "experimentId": container_id,
         "attribute": path_to_str(path),
         **DEFAULT_REQUEST_KWARGS,
     }
     try:
         return (
             self.leaderboard_client.api.prepareForDownloadFileSetAttributeZip(
                 **params
             )
             .response()
             .result
         )
     except HTTPNotFound:
         raise FetchAttributeNotFoundException(path_to_str(path))
Beispiel #5
0
 def download_file(
     self,
     container_id: str,
     container_type: ContainerType,
     path: List[str],
     destination: Optional[str] = None,
 ):
     try:
         download_file_attribute(
             swagger_client=self.leaderboard_client,
             container_id=container_id,
             attribute=path_to_str(path),
             destination=destination,
         )
     except ClientHttpError as e:
         if e.status == HTTPNotFound.status_code:
             raise FetchAttributeNotFoundException(path_to_str(path))
         else:
             raise
Beispiel #6
0
 def download_file_series_by_index(
     self,
     container_id: str,
     container_type: ContainerType,
     path: List[str],
     index: int,
     destination: str,
 ):
     try:
         download_image_series_element(
             swagger_client=self.leaderboard_client,
             container_id=container_id,
             attribute=path_to_str(path),
             index=index,
             destination=destination,
         )
     except ClientHttpError as e:
         if e.status == HTTPNotFound.status_code:
             raise FetchAttributeNotFoundException(path_to_str(path))
         else:
             raise
Beispiel #7
0
 def get_image_series_values(
     self,
     container_id: str,
     container_type: ContainerType,
     path: List[str],
     offset: int,
     limit: int,
 ) -> ImageSeriesValues:
     params = {
         "experimentId": container_id,
         "attribute": path_to_str(path),
         "limit": limit,
         "offset": offset,
         **DEFAULT_REQUEST_KWARGS,
     }
     try:
         result = (
             self.leaderboard_client.api.getImageSeriesValues(**params)
             .response()
             .result
         )
         return ImageSeriesValues(result.totalItemCount)
     except HTTPNotFound:
         raise FetchAttributeNotFoundException(path_to_str(path))