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

Support exiting if configuration is locked by another process #254

Open
jlapeyre opened this issue Feb 22, 2022 · 2 comments
Open

Support exiting if configuration is locked by another process #254

jlapeyre opened this issue Feb 22, 2022 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@jlapeyre
Copy link

Perhaps print a message and exit.

I am developing tools for Python projects that depend on Julia. I search for Julia installed by juliaup. Detecting if juliaup is not returning because the config file is locked is a bit of a trick. It's not Python-specific of course. Other projects that call juliaup will have to roll their own solution.

This is similar to #253. I good solution to these things might be an API for juliaup that uses machine readable input and output. Maybe json in and out.

@davidanthoff
Copy link
Collaborator

There is one API thing already: juliaup api getconfig1. I think your suggestion makes a lot of sense for that, we could for example just add a command line flag --timeout=5 to that particular command, in which case we would only wait for 5 seconds for the lock to free. If we aren't able to acquire the lock, we would just exist with an error return code, maybe?

I also did at some point think about a full bi-directional communication solution based on JSON-RPC, but given that that is much more involved, maybe the simple command line arg would already help?

The caveat is that I need to figure out how to actually specify a timeout in the locking code I use, but hopefully that can be done somehow.

@davidanthoff davidanthoff added the enhancement New feature or request label Mar 5, 2022
@davidanthoff davidanthoff added this to the Backlog milestone Mar 5, 2022
@jlapeyre
Copy link
Author

jlapeyre commented Mar 5, 2022

juliaup api getconfig1, yes, this has been very convenient for scripting. I rely on it.

bi-directional communication solution based on JSON-RPC

Agreed, I can see why this would not be the focus of development at the moment. Maybe something simpler, not bidirectional. Along the lines of juliaup api getconfig1. I guess you could go a long way reading and writing single-shot json payloads.

What I am trying to do is read juliaup api getconfig1. That fails if juliaup is, say, downloading a julia. Is it possible/sensible to have only a write lock? For the moment, I run juliaup status first, and read from a pipe. If I get the first words of the error message, then I can take whatever action I need to. Currently, my script errors. But, I could print a warning and skip the action. Maybe a timeout would be good enough. I mean, this shouldn't happen too often. Or maybe a query command juliaup api isconfiglocked, but I suppose you want to be parsimonious with the api. btw, the reason it matters for me is I am trying to make bulletproof scripts for an application where the dependency on Julia is completely hidden from the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants