Skip to content

Commit

Permalink
attempt fix live output post request handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ndharasz committed Oct 22, 2024
1 parent 999cd78 commit f2f079f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,16 @@ def main(args):
logging.info("Uploading predictions to %s", args.post_url)
csv_buffer = io.StringIO()
predictions.to_csv(csv_buffer)
retry_request_with_backoff(
lambda: (
csv_buffer.seek(0)
and requests.post(
args.post_url,
data=args.post_data,
files={"file": (predictions_csv_file_name, csv_buffer, "text/csv")},
)

def post_live_output():
csv_buffer.seek(0)
return requests.post(
args.post_url,
data=args.post_data,
files={"file": (predictions_csv_file_name, csv_buffer, "text/csv")},
)
)

retry_request_with_backoff(post_live_output)
else:
logging.info("Saving predictions to %s", predictions_csv_file_name)
with open(predictions_csv_file_name, "w") as f:
Expand Down

0 comments on commit f2f079f

Please sign in to comment.