globus / globus-compute

Globus Compute: High Performance Function Serving for Science
https://www.globus.org/compute
Apache License 2.0
146 stars 47 forks source link

Make Executor shutdown idempotent #1561

Closed khk-globus closed 4 months ago

khk-globus commented 4 months ago

At the point an executor has been shutdown, its state has already been set:

In refactoring for idempotency (early return), realize that there is no use to .join() the task submitter thread. The Python internals already clean up the underlying thread when the thread completes. All .join() does is wait for that -- there is no resource value in waiting, only algorithm logic, if necessary. Instead, take out the shutdown lock and drain the queue of tasks before sending the poison pill, then stop there. The thread will either complete or it won't, but because it's daemon=True, it won't hold up the shutdown process.

[sc-33249]

Type of change