How do I change the default OOD job path to point to the home directory?

Hi, I am testing out open OnDemand on a vm and I have been trying to figure out how to change the open OnDemand default path for newly created jobs from /home/user/ondemand/data/sys/myjobs/projects/default/ to my home directory. Any help on this would be appreciated.

The OnDemand job path already is rooted in the user’s home directory at ~/ondemand/data/sys/myjobs/projects/default. That path may be altered to ~/ (or any other writable-by-the-user path) using the environment variable OOD_DATAROOT. Note that the subpath project/default is hard coded, so if you really want job directories to be created directly in the user’s home directory then you will have to write some Ruby. A custom initializer could be added to /var/www/ood/sys/myjobs/config/initializers/ that would need to overwrite Workflow#staging_target_dir_name:

# e.g. /var/www/ood/sys/myjobs/config/initializers/change_staging_target_name.rb
require 'workflow'

class Workflow
  # remove the project/default namespace
  def staging_target_dir_name
    ''  # <- empty string
  end
end

Finally as a result of putting this together I noticed that we have a bug in the setup script for the Job Composer that impacts all versions of OnDemand less than v1.6.4 when OOD_DATAROOT and DATABASE_PATH are different and DATABASE_PATH does not exist yet (Github Issue). Installations that do not specify a custom DATABASE_PATH are not impacted by this defect.

I really appreciate your response. I will give this a try to see how it works. However, I realized that it always copies the content of the specified source path to the new workflow(path) created by OOD. Can this behavior be stopped either?

@sabival89 we do not have an official non-copying workflow solution for the Job Composer. I put together an example of how this might be done on Github. Unfortunately my example is much more invasive than the other initializer, and I wouldn’t suggest using it if you are installing OnDemand via RPMs as your changes will be overwritten on each upgrade.

1 Like

@sabival89 FYI I just closed the pull requests on how this could be done; as I do not believe that they are safe solutions to the problem. I realized that there are no protections for users from entering their home directories as jobs. This is an issue because once a job is created there are no controls to delete the job that do not also remove its job directory.

1 Like

@sabival89 I just marked this as a feature request as it is unresolved.

To clarify, there are two requests in this topic:

  1. Change the default path for newly created job directories to be in your home directory i.e. ~/ instead of ~/ondemand/data/sys/myjobs/projects/default/. The job directory names are currently incrementing integers, so if it wasn’t in a subdirectory like ~/ondemand_jobs/ we would also need to provide the ability to control naming of the created directories.
  2. Avoid copying directories specified by the workflow path. Presumably this is when you choose “New from path”? Are there any other use case where you want to avoid copying directories?
1 Like

@efranz Thank you. Please refer to my response below.

  1. Yes you are correct about providing the ability to control naming of the created directories. However, the ondemand default job path is quite okay in order to maintain an organized workspace and keep the functionalities working but, can it be shortened to something like~/ondemand/ondemand_jobs... rather than ~/ondemand/data/sys/myjobs/projects/default.... And well, these options could be made as “configurables” for the users.

  2. So when either of the options(From Template, From Specified Path & From Selected Job) is selected, all directories and files that exist in either of them are copied into the newly created job directory. I think it’s better if only the job script is copied rather than copying/duplicating files and directories per every new job creation.