-
Notifications
You must be signed in to change notification settings - Fork 1
Sending operations asynchronously #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c1fda0b
to
16294ab
Compare
_, alive = psutil.wait_procs(children, timeout=KILL_TIMEOUT) | ||
for child_proc in alive: | ||
_kill(child_proc) | ||
# finish with terminating self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys.exit()
would work as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actuall I would use os.killpg
using the parent's process group ID. This will kill all children processes on OS level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.killpg
is not available on Windows, sys.exit()
will just "close" the process, instead we would like to allow script to gentle handle the KeyboardInterrupt
and clean some stuff.
|
||
class QueueElement(NamedTuple): | ||
sequence_id: int | ||
occured_at: float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming this field to timestamp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if len(serialized_operation) > MAX_QUEUE_ELEMENT_SIZE: | ||
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})") | ||
if len(serialized_operation) > MAX_QUEUE_ELEMENT_SIZE: | ||
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Operation size" sounds a bit strange.
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})") | |
raise ValueError(f"The number of queued operations exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})") |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the number of operations and this probably will never be raised
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
a89c60f
to
e9659f3
Compare
Easier to get it working on main in separate PR
No description provided.