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

tempdir support #1122

Merged
merged 4 commits into from
Feb 14, 2020
Merged

tempdir support #1122

merged 4 commits into from
Feb 14, 2020

Conversation

stevengj
Copy link
Collaborator

@stevengj stevengj commented Feb 11, 2020

mp.make_output_directory() now makes a temporary directory with mkdtemp.

So, you can do sim.use_output_directory(mp.make_output_directory()) to work in a temporary directory.

It would be nice to add a parameter to use_output_directory that automatically deletes the directory when the simulation destructor is called.

@oskooi
Copy link
Collaborator

oskooi commented Feb 11, 2020

This does not seem to be working as expected: mp.make_output_directory() creates a directory in the current directory rather than in one of the system directories (i.e. /tmp) in the way that Python's tempfile.mkdtemp does. Unfortunately the C and Python version of mkdtemp are not the same.

(As an aside, the two failing Travis tests python/tests/bend_flux.py and python/tests/mode_coeffs.py are both due to NanoComp/libctl#53 which was recently merged. The hard-coded values in the two tests likely need to be updated. cc @danielwboyce.)

src/output_directory.cpp Outdated Show resolved Hide resolved
@stevengj
Copy link
Collaborator Author

It now puts it in the temporary directory (/tmp or similar).

@stevengj
Copy link
Collaborator Author

stevengj commented Feb 12, 2020

I also noticed that, contrary to its name, trash_output_directory does not actually seem to "trash" anything. It just calls mkdir to create the directory, but this does not delete any existing directory.

@stevengj stevengj merged commit 07acf52 into master Feb 14, 2020
@stevengj stevengj deleted the tempdir branch February 14, 2020 18:30
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* make_output_directory() makes tempdir

* rm old undocumented feature of symlinking latest_output in structure::set_output_directory

* make temporary directory in tmpdir

* more informative abort message
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.

2 participants