-
Notifications
You must be signed in to change notification settings - Fork 384
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
xonsh shell #203
Comments
|
After remarking on #193, I started looking into how xonsh integration could work. There are a few "ingredients":
Todo:
Here is a first conceptual session with some of the above: $ xonsh
$ cd /path/to/my/experiments
$ ls
my_experiment.py my_dataset.py
$ import my_dataset
$ ds = my_
$ import my_experiment
$ ex = my_experiment.MyExperiment('experiment', interactive=True)
$ config = {'a': 3, 'b': 4}
$ sacredx(ex, config_updates=config) |
@Qwlouse It seems an observer isn't what I want to log the command line history, because observers cannot trigger events. Is that correct? Can sacred be changed a bit so observers are able to trigger events? Essentially, at the time run is called I'd like to save the shell history json file, perhaps instead I'll needs something like what's done for the tfrecordwriter, but I looked in stflow and that works with @ decorators, which won't really be sensible on the command line. Suggestions? |
I've started writing things, see https://github.com/ahundt/sacredx. Would you be interested in incorporating it directly if it reaches a good point? Also, which entry would be ideal for the shell history json file, a run.info |
Hey, I'm not sure I understand your questions. And I'm afraid I would need to dig into xonsh to really give you helpful feedback. Observers do not trigger events, that is right. Observers listen to events. So when the experiment is started each observers started_event is called. And I would probably go for meta-info. A commandline option might be a good fit for what you want to do. class StoreHistoryOption(CommandLineOption):
"""Save the shell history as meta information."""
short_flag = 's'
@classmethod
def apply(cls, args, run):
"""Set this run to not warn about suspicous changes."""
run.meta_info['history'] = xonsh.somehow_retrieve_history() You could then add |
Hmm, the difference is xonsh is actually a shell implemented in python, so you can run executables like you would in bash or call python functions like you would in ipython. In other words, it is like an ipython prompt fused with a bash prompt so you might as well use the python session you're currently in. For that reason, using the existing command line API may not completely make sense because you can just make the python calls yourself. On the other hand, maybe it still does make sense to provide a direct command line, and I'd just have to add a tiny bit of extra glue to reorganize and pass things along correctly.... Regarding my other question: In essence, if the separate repository gets to a good point where it is more useful than just some minor sandbox code, would you be interested in merging it directly into sacred or should I keep it a separate repository permanently? |
Well, some of these options make sense even if called from the python interface. So I guess calling them Commandline options is a bit of a misnomer here.
At this point, I don't feel comfortable making promises. Using |
I just wanted to mention the xonsh shell (tutorial) to you guys because it seems like it might be the perfect way to use and integrate sacred. This is because they have similar principles where they have a very rich history to improve reproducibility. Xonsh is a full shell you can use much like bash, but it is implemented in python and you can call python code from the command line much like ipython.
This is just an FYI I'm writing because a light bulb just went off where I thought these two packages might compliment each other beautifully. :-)
No action needs to be taken so this can be closed unless there was specific interest in discussing things.
The text was updated successfully, but these errors were encountered: