Skip to content
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

Golem.start() and Golem.stop() #644

Merged
merged 14 commits into from
Sep 22, 2021
Merged

Conversation

johny-b
Copy link
Contributor

@johny-b johny-b commented Sep 10, 2021

resolves #561
resolves #606

@johny-b johny-b marked this pull request as ready for review September 14, 2021 14:11
@johny-b johny-b requested review from a team, filipgolem, shadeofblue and kmazurek September 14, 2021 14:11
@johny-b johny-b force-pushed the johny-b/again-561-non-context-manager branch from 0043832 to f489319 Compare September 14, 2021 14:26
@johny-b johny-b mentioned this pull request Sep 14, 2021
Copy link
Contributor

@kmazurek kmazurek left a comment

Choose a reason for hiding this comment

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

Looks good, left some minor naming/docstring comments.

yapapi/engine.py Outdated Show resolved Hide resolved
@@ -113,19 +115,41 @@ def subnet_tag(self) -> Optional[str]:
"""Return the name of the subnet, or `None` if it is not set."""
return self._engine.subnet_tag

async def __aenter__(self) -> "Golem":
@property
def operative(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of this property is somewhat vague, at least to me. How about we rename this to just started?

Copy link
Contributor Author

@johny-b johny-b Sep 17, 2021

Choose a reason for hiding this comment

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

This property is essentially "There was a start that had no stop after it".

I'm not sure if this is "started" - if you start and that stop something it might be both started and stopped at the same time (and that might be different than not having started at all).

Maybe "active" would be better? Or "running"?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with either... honestly

async def __aenter__(self) -> "Golem":
@property
def operative(self) -> bool:
"""Return True if Golem started and didn't stop"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""Return True if Golem started and didn't stop"""
"""Return `True` if this instance is currently started, `False` otherwise."""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As in the previous comment, I'm not sure if "started" is a good name.

@shadeofblue
Copy link
Contributor

shadeofblue commented Sep 17, 2021

btw, I wonder - do we think it's sensible to leave two examples out there?

as in, leave blender.py intact and add e.g. blender_standalone.py showcasing the non-context-manager usage?

the issue I have with updating blender.py is that part of our handbook is based on this example and we'll need to update all the places there that are based on it ... (at least those pieces that go through the code) ... plus, we'll need to completely split the Python and JS tutorial as there will be no commonality between them now...

@zakaprov @johny-b ?

Co-authored-by: Kuba Mazurek <[email protected]>
@johny-b
Copy link
Contributor Author

johny-b commented Sep 17, 2021

btw, I wonder - do we think it's sensible to leave two examples out there?

as in, leave blender.py intact and add e.g. blender_standalone.py showcasing the non-context-manager usage?

I don't like this. I think we already have too many examples that differ only on a few lines and have dozens copy-pasted lines.
I won't insist though - if you think this is a good way, than fine.

the issue I have with updating blender.py is that part of our handbook is based on this example and we'll need to update all the places there that are based on it ... (at least those pieces that go through the code) ... plus, we'll need to completely split the Python and JS tutorial as there will be no commonality between them now...

That's a good point.
Maybe we should modify some other example? E.g. ssh that is not in the handbook yet?

@johny-b
Copy link
Contributor Author

johny-b commented Sep 17, 2021

@shadeofblue I think you should make the decision : )

@shadeofblue
Copy link
Contributor

@shadeofblue I think you should make the decision : )

the only issue I have with modifying some other example is that maybe somebody will think that e.g. to interact with a VPN you have to use non-context-manager Golem... that's why having two, otherwise identical, examples side-by-side would, I think be clearer for the outside world

@johny-b johny-b merged commit 5e14c4f into master Sep 22, 2021
@shadeofblue shadeofblue deleted the johny-b/again-561-non-context-manager branch December 21, 2021 09:38
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.

Allow to start again a Golem that was stopped feature: non-context-manager-based access to the Golem engine
3 participants