Make heatconduction thread safe#198
Conversation
|
For now this is only 2d. Also I still left the original behavior (reading from files) in case this is still needed. |
ffelten
left a comment
There was a problem hiding this comment.
Simple and working, the kind of solutions I like
| np.save(serialized_design, design) | ||
|
|
||
| current_dir = os.getcwd() | ||
| output_path = f"templates/RES_SIM/Performance-{os.getpid()}.txt" |
There was a problem hiding this comment.
👉 This could be a nice pattern for file creation in general
There was a problem hiding this comment.
I changed the path pattern a bit.
It is now: templates/output-by-pid/{os.getpid()}/{original_filename}.
This way, I can reuse the pid directory for other intermediate files
4a9b26d to
5da94b8
Compare
|
3d is also done now. |
|
@ffelten As I changed a couple of things since your last review, could I ask you again to have a look before I merge? |
ffelten
left a comment
There was a problem hiding this comment.
A few minor things. Thanks for cleaning this stuff up, it felt good reading this PR
| # Load initial design image | ||
| image = np.load(input_path) | ||
| os.remove(input_path) # Remove after loading | ||
| image = np_array_from_stdin() |
There was a problem hiding this comment.
I would read all the inputs at the beginning of the script instead
| # Load initial design image | ||
| image = np.load(input_path) | ||
| os.remove(input_path) # Remove after loading | ||
| image = np_array_from_stdin() |
| cli_module_path = cli.__file__ | ||
|
|
||
| # Copy required stuff to a templates subfolder. | ||
| # We cannot just mount, as the engibench folder might not be a subfolder of |
There was a problem hiding this comment.
Indeed, was about to ask if you tried to pip install and run this from another directory?
| ], | ||
| stdin=stdin, | ||
| ) | ||
| return load_output(output_path) |
There was a problem hiding this comment.
I'm not super fan of passing the load_output function here, it would be clearer at call site if the caller receives the output path and loads it himself, no?
There was a problem hiding this comment.
To me the load_output argument is like a choice of the format. But yes, I agree that this would disentangle the execution flow a bit
5da94b8 to
7cc7d3c
Compare
Description
utils.containeros.getpid()as a suffix for the output files generated by the scripts runnsing inside the container to prevent overwritesProbably related to: #193
Part of: #191
Type of change
Please delete options that are not relevant.