Skip to content

Commit 5805f4e

Browse files
committed
update
2 parents 09c4266 + 18719b8 commit 5805f4e

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/lightning/data/processing/data_processor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
_TORCH_GREATER_EQUAL_2_1_0,
3030
)
3131
from lightning.data.processing.readers import BaseReader
32+
from lightning.data.processing.utilities import _create_dataset
3233
from lightning.data.streaming import Cache
3334
from lightning.data.streaming.cache import Dir
3435
from lightning.data.streaming.client import S3Client
3536
from lightning.data.streaming.resolver import _resolve_dir
3637
from lightning.data.utilities.broadcast import broadcast_object
3738
from lightning.data.utilities.packing import _pack_greedily
38-
from lightning.data.processing.utilities import _create_dataset
3939

4040
if _TORCH_GREATER_EQUAL_2_1_0:
4141
from torch.utils._pytree import tree_flatten, tree_unflatten, treespec_loads

src/lightning/data/processing/utilities.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33
import urllib
44
from contextlib import contextmanager
55
from subprocess import Popen
6-
from typing import Any, Callable, Optional, Tuple
6+
from typing import Any, Callable, List, Optional, Tuple, Union
77

88
from lightning.data.constants import _IS_IN_STUDIO, _LIGHTNING_CLOUD_LATEST
99

10-
from typing import Optional, List, Tuple, Union
11-
import os
12-
1310
if _LIGHTNING_CLOUD_LATEST:
14-
from lightning_cloud.rest_client import LightningClient
1511
from lightning_cloud.openapi import (
1612
ProjectIdDatasetsBody,
1713
V1DatasetType,
1814
)
1915
from lightning_cloud.openapi.rest import ApiException
16+
from lightning_cloud.rest_client import LightningClient
2017

2118

2219
def _create_dataset(
@@ -33,9 +30,7 @@ def _create_dataset(
3330
name: Optional[str] = None,
3431
version: Optional[int] = None,
3532
):
36-
"""
37-
Create a dataset with metadata information about its source and destination
38-
"""
33+
"""Create a dataset with metadata information about its source and destination."""
3934
project_id = os.getenv("LIGHTNING_CLOUD_PROJECT_ID", None)
4035
cluster_id = os.getenv("LIGHTNING_CLUSTER_ID", None)
4136
user_id = os.getenv("LIGHTNING_USER_ID", None)
@@ -70,10 +65,10 @@ def _create_dataset(
7065
type=dataset_type,
7166
version=version,
7267
),
73-
project_id=project_id
68+
project_id=project_id,
7469
)
7570
except ApiException as ex:
76-
if 'already exists' in str(ex.body):
71+
if "already exists" in str(ex.body):
7772
pass
7873
else:
7974
raise ex

0 commit comments

Comments
 (0)