|
|
## 1. Fixing broken links to results files
|
|
|
|
|
|
AweSim apps currently have been storing absolute paths to files in the database. The currently home directory paths are prefixed with `/users/$PROJECT/$USER` (i.e. `/users/PZS0562/efranz/awesim_data/awe0011/container_fill_sim/containers/1`) whereas previously the paths were prefixed with `/nfs/$NFS_SERVER_NUMBER/$USER` (i.e. `/nfs/17/efranz/awesim_data/awe0011/container_fill_sim/containers/1`).
|
|
|
|
|
|
Apps running now have their AweSim dataroot set to the value of `$HOME`, which uses the new path. For AweSim apps, we have symlinks so the old paths still work.
|
|
|
|
|
|
On [Resolving-the-url-to-a-results-file-of-a-simulation](Resolving-the-url-to-a-results-file-of-a-simulation) I recommended adding a method to get the relative path to the staged directory of a job, so that you could use this to build the URL to access results:
|
|
|
|
|
|
```ruby
|
|
|
def staged_dir_relative_path
|
|
|
Pathname.new(staged_dir).relative_path_from(AwesimRails.dataroot)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
The problem is that when
|
|
|
|
|
|
1. `staged_dir` is `/nfs/17/efranz/awesim_data/awe0011/container_fill_sim/containers/1` and
|
|
|
2. `AwesimRails.dataroot` is `/users/PZS0562/efranz/awesim_data/awe0011/container_fill_sim`
|
|
|
|
|
|
instead of the method `staged_dir_relative_path ` returning a path `containers/1` it returns `../../../../../../nfs/17/efranz/awesim_data/awe0011/container_fill_sim/containers/1`
|
|
|
|
|
|
A solution is to avoid using `relative_path_from` between 2 different paths. I updated [Resolving-the-url-to-a-results-file-of-a-simulation](Resolving-the-url-to-a-results-file-of-a-simulation) to reflect this:
|
|
|
|
|
|
```ruby
|
|
|
def staged_dir_relative_path
|
|
|
Pathname.new(staging_target_dir_name).join(Pathname.new(staged_dir).basename)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
## 2. Another approach
|
|
|
|
|
|
If a staged directory of a simulation is always 2 levels below the dataroot in your app, you can do this:
|
|
|
|
|
|
```ruby
|
|
|
def staged_dir_relative_path
|
|
|
Pathname.new(staged_dir).relative_path_from(Pathname.new(staged_dir).parent.parent)
|
|
|
end
|
|
|
```
|
|
|
|
|
|
## 3. Fixing links to output and error files
|
|
|
|
|
|
Also, our current recommendation for accessing output and error files is to set the name of the output and error file in the PBS headers of the job so that you know which file to look for: [Accessing-Output-and-Error-files](Accessing-Output-and-Error-files)
|
|
|
|
|
|
But if you followed my original recommendation (pre appkit-1.0) to add some methods to the Job class to get the output and error files, there might be similar problem that needs to be fixed. You can see the changes we made to Container Fill Sim to fix this: https://github.com/AweSim-OSC/containerfillsim/commit/bf8cad61755d2020a9b4f343308deec981e4a650 |