mirror of
https://github.com/clearml/clearml
synced 2025-02-02 01:54:23 +00:00
Fix forked process will not call _at_exit and flush all outstanding reports
This commit is contained in:
parent
7b5c676ab2
commit
7625de3f2f
@ -99,7 +99,16 @@ class PatchOsFork(object):
|
|||||||
# just make sure we flush the internal state (the at exist caught by the external signal does the rest
|
# just make sure we flush the internal state (the at exist caught by the external signal does the rest
|
||||||
# in theory we should not have to do any of that, but for some reason if we do not
|
# in theory we should not have to do any of that, but for some reason if we do not
|
||||||
# the signal is never caught by the signal call backs, not sure why....
|
# the signal is never caught by the signal call backs, not sure why....
|
||||||
sleep(0.1)
|
|
||||||
|
# Since at_exist handlers do not work on forked processes, we have to manually call them here
|
||||||
|
if task:
|
||||||
|
try:
|
||||||
|
# not to worry there is a double _at_exit protection implemented inside task._at_exit()
|
||||||
|
# noinspection PyProtectedMember
|
||||||
|
task._at_exit()
|
||||||
|
except: # noqa
|
||||||
|
pass
|
||||||
|
|
||||||
# noinspection PyProtectedMember, PyUnresolvedReferences
|
# noinspection PyProtectedMember, PyUnresolvedReferences
|
||||||
return os._org_exit(*a_args, **a_kwargs)
|
return os._org_exit(*a_args, **a_kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user