Skip to content

Commit

Permalink
added upload json
Browse files Browse the repository at this point in the history
  • Loading branch information
Moasib-Arif committed Oct 31, 2024
1 parent 7acde76 commit b3b47a0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dpypelines/pipeline/dataset_ingress_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,28 @@ def dataset_ingress_v1(files_dir: str, pipeline_config: dict):
)
de_notifier.failure()
raise err
# If the supplementary distribution is a JSON file, upload to the Upload Service
elif supp_dist_path.suffix == ".json":
try:
upload_client.upload_new_json(supp_dist_path)
logger.info(
"Uploaded supplementary distribution",
data={
"supplementary_distribution": supp_dist_path,
"upload_url": upload_url,
},
)
except Exception as err:
logger.error(
"Error uploading JSON file to Upload Service",
err,
data={
"supplementary_distribution": supp_dist_path,
"upload_url": upload_url,
},
)
de_notifier.failure()
raise err
else:
raise NotImplementedError(
f"Uploading files of type {supp_dist_path.suffix} not supported."
Expand Down
14 changes: 14 additions & 0 deletions dpypelines/pipeline/generic_file_ingress_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,20 @@ def generic_file_ingress_v1(files_dir: str, pipeline_config: dict):
)
notifier.failure()
raise err
elif required_file_path.suffix == ".json":
try:
upload_client.upload_new_json(required_file_path)
logger.info(
"File uploaded.", data={"file_path": required_file_path}
)
except Exception as err:
logger.error(
"Error uploading file.",
err,
data={"file_path": required_file_path},
)
notifier.failure()
raise err
else:
raise NotImplementedError(
f"Uploading file type {required_file_path.suffix} not currently supported."
Expand Down

0 comments on commit b3b47a0

Please sign in to comment.