(this should probably go into gem docs for osc_machete_rails)
Simulations are staged (template is copied, variables substituted) to a path under the dataroot in a directory corresponding to the simulation model name:
- for a simulation model titled
Container
, the template staged to$DATAROOT/containers
- for a simulation model titled
Simulation
, the template is staged to$DATAROOT/simulations
In order to avoid staging conflicts, a unique sub-directory is always created for each template that is staged. For example, given a Simulation instance sim with an id of 24 and an AwesimRails.dataroot directory with a listing including:
simulations/
--- 1/
--- 2/
--- 3/
osc-machete would stage the simulation to:
simulations/4/
not
simulations/24/
If your simulation model has the a String attribute defined called staged_dir
, and the model has a workflow (i.e. calls has_workflow_of
), staged_dir
will be set with the path to the staged directory. Then, given a simulation called Container
you could get the path to this directory using Container#staged_dir
i.e.
c = Container.find(24) # get the container with id 24
c.staged_dir #=> "/nfs/17/efranz/awesim_data/efranz/container_fill_sim/containers/4"
If your simulation has one or more jobs (i.e. model that includes OscMacheteRails::Statusable
) where the shell script is in the root of the staged directory, the attribute job_path
will be set to the staged directory i.e.
c = Container.find(24) # get the container with id 24
c.jobs.first.job_path #=> "/nfs/17/efranz/awesim_data/efranz/container_fill_sim/containers/4"
c.jobs.first.job_path == c.staged_dir
Of course, be careful with this. If the job you are inspecting uses a script in a subdirectory of the staged directory, this won't work:
c = Container.find(24) # get the container with id 24
c.staged_dir #=> "/nfs/17/efranz/awesim_data/efranz/container_fill_sim/containers/4"
c.jobs.last.job_path #=> "/nfs/17/efranz/awesim_data/efranz/container_fill_sim/containers/4/post_processing"
c.jobs.last.job_path != c.staged_dir