-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3215 from grondo/issue#3186
python: allow Future.get() and wait_for() to be interrupted by Ctrl-C
- Loading branch information
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
# future/rpc.get() should be interruptible: | ||
|
||
SERVICE="t3186" | ||
waitfile=${SHARNESS_TEST_SRCDIR}/scripts/waitfile.lua | ||
|
||
log() { echo "t3186: $@" >&2; } | ||
die() { log "$@"; exit 1; } | ||
|
||
cat <<EOF >get-intr.py || die "Failed to create test script" | ||
import flux | ||
from flux.future import Future | ||
f = flux.Flux() | ||
Future(f.service_register("$SERVICE")).get() | ||
print("get-intr.py: Added service $SERVICE", flush=True) | ||
# The following should block until interrupted: | ||
f.rpc("${SERVICE}.echo").get() | ||
EOF | ||
|
||
log "Created test script get-intr.py" | ||
|
||
flux python get-intr.py >t3186.log 2>&1 & | ||
pid=$! | ||
|
||
log "Started PID=$pid" | ||
|
||
$waitfile --timeout=10 --pattern="Added service" t3186.log | ||
|
||
log "Sending SIGINT to $pid" | ||
kill -INT $pid || die "Failed to kill PID $pid" | ||
wait $! | ||
STATUS=$? | ||
test $STATUS -eq 130 || die "process exited with $STATUS expected 130" | ||
|
||
log "Python script exited with status $STATUS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters