Skip to content

Commit

Permalink
Use get_artifact_handle instead of smart_open directly
Browse files Browse the repository at this point in the history
  • Loading branch information
mckornfield committed Aug 9, 2023
1 parent ecfef78 commit edddcf0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
boto3~=1.20
dask[dataframe]==2023.5.1
gretel-client>=0.16.0
gretel-client>=0.16.12
jinja2~=3.1
networkx~=3.0
numpy~=1.20
Expand Down
5 changes: 2 additions & 3 deletions src/gretel_trainer/relational/sdk_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ def download_file_artifact(
artifact_name: str,
out_path: Union[str, Path],
) -> None:
download_link = gretel_object.get_artifact_link(artifact_name)
try:
with smart_open.open(download_link, "rb") as src, smart_open.open(
with gretel_object.get_artifact_handle("data") as src, smart_open.open(
out_path, "wb"
) as dest:
shutil.copyfileobj(src, dest)
Expand All @@ -80,7 +79,7 @@ def sqs_score_from_full_report(self, report: dict[str, Any]) -> Optional[int]:
return field_dict["value"]

def get_record_handler_data(self, record_handler: RecordHandler) -> pd.DataFrame:
with smart_open.open(record_handler.get_artifact_link("data"), "rb") as data:
with record_handler.get_artifact_handle("data") as data:
return pd.read_csv(data)

def start_job_if_possible(
Expand Down

0 comments on commit edddcf0

Please sign in to comment.