try: except: block to catch recent "FileNotFoundError".
Made this WIP since there is an issue with error reporting.
Fixed.
Most likely the FileNotFoundError is a red herring. Probably the cutechess command line for the tuning test was just too long (I think the FileNotFoundError occurs only on windows).
@ppigazzini Is anything stopping committing this trivial PR? Each time a FileNotFoundError occurs (cfr the event log) the affected worker will quit (an unclassified exception is a fatal error). It will encourage users to run their workers in a loop (which is not recommended in general).
For me the logical explanation for this error is a cutechess-cli command line that is too long for Windows (note that the error only happens on Windows).
I don't think it is ugly. It is a standard pattern used in many places in the worker: Popen combined with catching OSError and SubprocessError.
The try added in this PR is fine, this 3 level try is ugly. https://github.com/glinscott/fishtest/blob/599898efbd0488741eb67eb413d7daff64f32185/worker/games.py#L1025-L1043
IMO this should work, dropping one nested try and dropping a bare except.
finally:
# We nicely ask cutechess-cli to stop.
try:
send_sigint(p)
except Exception as e:
print(
"\nException in send_sigint:\n", e, sep="", file=sys.stderr
)
# now wait...
print(
"\nWaiting for cutechess-cli to finish ... ", end="", flush=True
)
try:
p.wait(timeout=CUTECHESS_KILL_TIMEOUT)
except subprocess.TimeoutExpired:
print("timeout", flush=True)
kill_process(p)
else:
print("done", flush=True)
Triggered the workers update, thank you @vdbergh :)
Most likely the FileNotFoundError is a red herring. Probably the cutechess command line for the tuning test was just too long (I think the FileNotFoundError occurs only on windows).
You are right, see https://github.com/glinscott/fishtest/issues/1360#issuecomment-1248344165
cmd characters upper acceptable limit for subprocess.Popen():
- 32764 Windows
- ~418000 Linux ((I got two slightly different values with WSL and Ubuntu)