Skip to content

Commit

Permalink
move sci inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikellepetrillo committed Dec 11, 2024
1 parent 846b013 commit d885b27
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/firecloud_api/firecloud_api2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def _get_user_token(self, credentials):
if not credentials.valid or (credentials.expiry and (credentials.expiry - datetime.now(timezone.utc)).total_seconds() < 60):
logging.info("Refreshing user access token.")
credentials.refresh(Request())
logging.info("Token Refreshed.")
return credentials.token

def submit_job(self, submission_data_file):
Expand Down Expand Up @@ -149,20 +150,21 @@ def poll_job_status(self, submission_id):

# Continuously poll the status of the submission until completion
while True:
logging.info(f"Polling submission ID: {submission_id}")
status_response = requests.get(status_url, headers=self.headers)

# Check if the response status code is successful (200)
if status_response.status_code != 200:
print(f"Error: Received status code {status_response.status_code}", file=sys.stderr)
print(f"Response content: {status_response.text}", file=sys.stderr)
logging.error(f"Error: Received status code {status_response.status_code}", file=sys.stderr)
logging.info(f"Response content: {status_response.text}", file=sys.stderr)
return {}

try:
# Parse the response as JSON
status_data = status_response.json()
except json.JSONDecodeError:
print("Error decoding JSON response.", file=sys.stderr)
print(f"Response content: {status_response.text}", file=sys.stderr)
logging.error("Error decoding JSON response.", file=sys.stderr)
logging.info(f"Response content: {status_response.text}", file=sys.stderr)
return {}

# Retrieve workflows and their statuses
Expand Down

0 comments on commit d885b27

Please sign in to comment.