generated from d3b-center/d3b-python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add download job result subcommand
- Loading branch information
1 parent
95fd403
commit da7b851
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Download job results from Dewrangle.""" | ||
|
||
from . import helper_functions as hf | ||
|
||
def download_job(jobid, token=None): | ||
""" | ||
Function to download results from Dewrangle | ||
Input: Dewrangle job id | ||
Output: object with job resuls | ||
""" | ||
|
||
client = hf.create_gql_client(api_key=token) | ||
|
||
return hf.download_job_result(jobid, client=client, api_key=token) | ||
|
||
|
||
def main(args): | ||
"""Main function.""" | ||
|
||
status, job_df = download_job(args.jobid) | ||
if status == "Complete": | ||
job_df.to_csv(args.outfile) | ||
else: | ||
print("Job incomplete, please check again later.") |