Skip to content

Change actor.__ray_kill__() to ray.kill(actor)#7360

Merged
edoakes merged 3 commits intoray-project:masterfrom
edoakes:ray-kill-api
Feb 28, 2020
Merged

Change actor.__ray_kill__() to ray.kill(actor)#7360
edoakes merged 3 commits intoray-project:masterfrom
edoakes:ray-kill-api

Conversation

@edoakes
Copy link
Copy Markdown
Collaborator

@edoakes edoakes commented Feb 27, 2020

Why are these changes needed?

Double-underscore methods are generally reserved for builtin keywords.

Related issue number

Checks

@AmplabJenkins
Copy link
Copy Markdown

Can one of the admins verify this patch?

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/22525/
Test FAILed.

@edoakes
Copy link
Copy Markdown
Collaborator Author

edoakes commented Feb 28, 2020

cc @mitar

Copy link
Copy Markdown
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but notice the comment I left

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/22528/
Test FAILed.

you can call ``actor.__ray_terminate__.remote()`` instead to queue a
termination task.

If this actor is reconstructable, it will be attempted to be reconstructed.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior sounds right to me. Just saw this PR which might be doing the opposite (though I didn't check) #7346.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be optional? Like an argument to kill? Or maybe ray.restart(actor) when you want to reconstruct it? I find it strange for this to happen automatically?

immediately. Any atexit handlers installed in the actor will still be run.

If you want to kill the actor but let pending tasks finish,
you can call ``actor.__ray_terminate__.remote()`` instead to queue a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Egh, can we also rename __ray_terminate__? This is really not a good idea to use double underscores. Those are reserved for Python use.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the API should be ray.terminate(actor) and ray.kill(actor). It is OK then for ray.terminate to call actor.__ray_terminate__ and for subclasses of actors to subclass __ray_terminate__ to customize its behavior. That would be aligned with Python best practices. But public API should never call __ray_terminate__ directly.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but let's discuss/do that separately.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #7382 to followup here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants