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

Python: Context Manager #131

Open
andre-merzky opened this issue Apr 17, 2021 · 2 comments
Open

Python: Context Manager #131

andre-merzky opened this issue Apr 17, 2021 · 2 comments
Labels
python-bindings question Further information is requested

Comments

@andre-merzky
Copy link
Collaborator

This is related to #130: should we provide a context manager interface?:

    with jpsi.JobExecutor(url) as jex:

        job = jpsi.Job(jpsi.JobSpec("executable"='/bin/true'))
        jex.submit(job)
        ...

That would serve a similar purpose as the close() in #130, to free backend resources when jex goes out of scope. I assume that this will not be used in somewhat complex use cases where jex is unlikely to live in a simple scope as above, but it does make canonical examples simple and intuitive...

@andre-merzky andre-merzky added question Further information is requested python-bindings labels Apr 17, 2021
@hategan
Copy link
Collaborator

hategan commented Apr 17, 2021

I think we talked about this during one of our meetings when a concern was voiced about (possibly unnecessary) API growth. In that spirit, I think there should be a rather high and clear need before anything should be added.

@andre-merzky
Copy link
Collaborator Author

Let's wait for #130 to get resolved - if that gets closed then there is no need for a ContextManager either...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python-bindings question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants