Skip to content

Commit

Permalink
Use strategy_period in test, instead of custom thread (#3381)
Browse files Browse the repository at this point in the history
PR #2816 introduced a workaround in the polling API by adding a new thread
to call job status poller poll() method more frequently than the
JobStatusPoller invokes that method.

PR #3246 introduced general configurability of the JobStatusPoller poll period.

This PR replaces the thread from #2816 with the configuration option from
#3246.

This PR removes one thread left running at the end of this test case, in
--config local tests.
  • Loading branch information
benclifford authored Apr 22, 2024
1 parent fb93f82 commit b964756
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions parsl/tests/test_scaling/test_regression_1621.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
from parsl.launchers import SimpleLauncher
from parsl.providers import LocalProvider

# Timing notes:
# The configured strategy_period must be much smaller than the delay in
# app() so that multiple iterations of the strategy have had a chance
# to (mis)behave.
# The status polling interval in OneShotLocalProvider must be much bigger
# than the above times, so that the job status cached from the provider
# will not be updated while the single invocation of app() runs.


@parsl.python_app
def app():
Expand Down Expand Up @@ -55,20 +63,12 @@ def test_one_block(tmpd_cwd):
)
],
strategy='simple',
strategy_period=0.1
)

parsl.load(config)
dfk = parsl.dfk()

def poller():
import time
while True:
dfk.job_status_poller.poll()
time.sleep(0.1)
with parsl.load(config):
app().result()

threading.Thread(target=poller, daemon=True).start()
app().result()
parsl.dfk().cleanup()
parsl.clear()

assert oneshot_provider.recorded_submits == 1

0 comments on commit b964756

Please sign in to comment.