Skip to content

Commit

Permalink
add loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Feb 27, 2024
1 parent 4c08327 commit 99c53f8
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions examples/client_query_from_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,34 @@ def main():
# print(query_submit_result)
# print(query_submit_result.besobj.ClientQuery.ID)

print("... waiting for results ...")

# TODO: loop this to keep getting more results until all return or any key pressed
time.sleep(20)

# get the actual results:
# NOTE: this might not return anything if no clients have returned results
# this can be checked again and again for more results:
query_result = bes_conn.get(
bes_conn.url(f"clientqueryresults/{query_submit_result.besobj.ClientQuery.ID}")
)

print(query_result)
previous_result = ""
i = 0
try:
# loop ~90 second for results
while i < 9:
print("... waiting for results ... Ctrl+C to quit loop")

# TODO: loop this to keep getting more results until all return or any key pressed
time.sleep(10)

# get the actual results:
# NOTE: this might not return anything if no clients have returned results
# this can be checked again and again for more results:
query_result = bes_conn.get(
bes_conn.url(
f"clientqueryresults/{query_submit_result.besobj.ClientQuery.ID}"
)
)

if previous_result != str(query_result):
print(query_result)
previous_result = str(query_result)

i += 1
except KeyboardInterrupt:
print("loop interuppted")

print("script finished")


if __name__ == "__main__":
Expand Down

0 comments on commit 99c53f8

Please sign in to comment.