Skip to content

Remove return bool from Channel.close() #3403

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

Merged
merged 3 commits into from
May 16, 2024
Merged

Conversation

benclifford
Copy link
Collaborator

@benclifford benclifford commented Apr 29, 2024

Theres was no defined meaning to the return bool either in the code or in the human text:

  • no code calls close to give an example of interpretation

  • it's not success/fail because local channel returns False to indicate that it didn't need to do anything, not that there was a failure.

Other .close() style methods return None and raise an exception if there is a problem. This PR pushes Channel.close() in this direction.

A separate PR will actually invoke this .close() method.

Changed Behaviour

This is an apparently unused return value so should not affect anything.

Type of change

  • Code maintenance/cleanup

Theres was defined meaning to the return bool either in the code
or in the human text:

- no code calls close to give an example of interpretation

- it's not success/fail because local channel returns False
to indicate that it didn't need to do anything, not that there
was a failure.

Other .close() style methods return None and raise an exception
if there is a problem. This PR pushes Channel.close() in this
direction.

A separate PR will actually invoke this .close() method.
Copy link
Collaborator

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

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

I'm not sure I buy the argument in this case that just because it's not utilized that it should be removed. On the other hand, "meh." We can re-add it at a future date, concomitant with its actual use-case, if needs be.

@benclifford
Copy link
Collaborator Author

@khk-globus the argument isn't that it isn't used - it's that it has no defined meaning if you try to use it for ... something?

@benclifford benclifford merged commit 441a369 into master May 16, 2024
6 checks passed
@benclifford benclifford deleted the benc-exit-channel-close branch May 16, 2024 13:35
benclifford added a commit that referenced this pull request Jul 2, 2024
Following on from #3403, which tightens the type signal of Channel.close(),
this PR makes the DFK actually call Channel.close() when it shuts down an
executor.

On the LocalChannel, this has no effect. On the SSH Channels, this shuts
down the SSH connection and removes a running thread.
benclifford added a commit that referenced this pull request Jul 11, 2024
Following on from #3403, which tightens the type signature of unused Channel.close(), this PR makes the DFK actually call Channel.close() when it shuts down an executor.

At startup, the DFK chooses whether to manage things with channels by checking for the presence of a script_dir attribute on the relevant provider (!) and this PR sticks with that same informal protocol.

On the LocalChannel, this has no effect. On the SSH Channels, this shuts down the SSH connection and removes an otherwise-abandoned thread.
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.

None yet

2 participants