question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File Storage Observer, know where files are dumped during run

See original GitHub issue

So I have read the Observing an experiment documentation up and down and the following isn’t clear to me:

If I want to run an experiment and keep track of just some basic information (e.g. the config and the acc) using the File Observer, how can I know where (what subdir) it is writing to?

I set the directory where I want all the experiments to be written to, but once I call an experiment, I do not know what the subdir will be (seems to be just enumerated…)

ex.observers.append(FileStorageObserver.create(experiment_dir))

Why would I want to know this?

Well returning the weights would results in them being dumped into results of the run file. This is not efficient and a poor idea.

The documentation for custom information suggests large data separately, and using add_artifact to save it to the DB.

I do not need two copies of the file.

So it would be nice if I could, via _run, access "observer_dump_loc" so I can write my files there:

os.path.join(_run["observer_dump_loc"], "all_this_data.npz")

# writes to /experiment_dir/<observer_dump_loc>/all_this_data.npz

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

2reactions
JarnoRFBcommented, Mar 1, 2019

Totally see your point here. A temporary directory per run sounds like a workable solution. I take it as a feature request! Maybe mkdtemp already does it. Meanwhile you can prefix all artifact files with _run._id and delete them right after you added them. This should keep the naming management to a minimum.

0reactions
SomeoneSergecommented, Apr 21, 2019

Hi. What prevents us from allowing ndarray’s and streams as add_artifact arguments? That would’ve sure solved the naming issue as we wouldn’t have any names and also having to dump weights/etc into a file first isn’t very convenient protocol. If some underlying package only accepts filenames (mongo? I’m only making a guess) then perhaps sacred could bridge the gap and transparently to user make a temp. Also, sometimes a user of sacred may indeed need a temporary when some other package he uses only provides filename interface – so even with add_artifact supporting buffers it would be still handy to have a convenience function that makes a named temporary associated with the current run and returns the name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collected Information — Sacred 0.8.3 documentation
For the Mongo Observer, metrics are stored in the metrics collection of MongoDB and are identified by their name (e.g. “training.loss”) and the...
Read more >
FileObserver - Android Developers
Monitors files (using inotify) to fire an event after files are accessed or changed by any process on the device (including this one)....
Read more >
FileSystemWatcher Class (System.IO) - Microsoft Learn
The component is set to watch for changes in LastWrite and LastAccess time, the creation, deletion, or renaming of text files in the...
Read more >
File observer stops working after some time - Stack Overflow
it stops after some time.I dont get the exact time but doesnt work always though I call startWatching() in service in a loop...
Read more >
Script to monitor folder for new files? - Unix Stack Exchange
You should consider using inotifywait , as an example: inotifywait -m /path -e create -e moved_to | while read dir action file; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found