forked from ufs-community/ufs-srweather-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use non-login shell for
launch_FV3LAM_wflow.sh
; remove support for …
…`WCOSS_CRAY`; fix cron capability for `tcsh` users on Cheyenne (ufs-community#675) * Remove unneeded sourcing of source_util_funcs.sh; add "%s" to printf calls since that's the proper calling method; edit comments. * Generalize machine files. Details: * Add a wrapper (source_machine_file.sh) for sourcing the machine file that allows other commands common to all machines to be called. * Change the scalar variable MODULE_INIT_PATH in the machine files to the array variable ENV_INIT_SCRIPTS_FPS that specifies the list of system scripts that need to be sourced (e.g. to make the "module" command available in a given script). This is needed because on Cheyenne, at least two system scripts need to be sourced (to enable "module" and "qsub"). * Move the "ulimit" commands at the ends of the machine files into the new variable PRE_TASK_CMDS so that they are not called every time the machine file is sourced. They will be called only if a given script issues an "eval ${PRE_TASK_CMDS}" (which all the ex-scripts will do). * In the relevant ex-scripts: (1) Change sourcing of machine files to use the wrapper source_machine_file.sh; (2) Use "eval" to evaluate the contents of PRE_TASK_CMDS. * In the WE2E script, change sourcing of the machine file to use the wrapper source_machine_file.sh. * Add new variable valid_vals_BOOLEAN to constants.sh so that this file can be sourced and the valid values for a boolean can be made available to any other script. * Bug fix. * Remove file that was accidentally added in previous commit. * Change the way crontab is called so that it also works on Cheyenne (for tcsh users). Details: * Introduce new function get_crontab_contents() that takes as input whether or not the calling script is itself being called from a cron job and returns (1) the path to the appropriate crontab command and (2) the contents of the user's cron table. * Such a function is needed because on Cheyenne, the location of the crontab command is different depending on whether or not the script that's calling crontab is itself called from a cron job (because on Cheyenne, "crontab" is containerized, and that complicates things). * Use get_crontab_contents() in generate_FV3LAM_wflow.sh and launch_FV3LAM_wflow.sh (instead of simply calling "crontab" because the latter approach doesn't work on Cheyenne, at least not with users whose login shell is tcsh). * Add "called_from_cron" as an optional argument to launch_FV3LAM_wflow.sh [so that it can then be passed on to get_crontab_contents()]. This argument is only used in the cron job that relaunches the workflow (which is created only if USE_CRON_TO_RELAUNCH is set to "TRUE"). * Having an optional argument like this seems to be the best way to tell launch_FV3LAM_wflow.sh whether or not it is running from a cron job. * launch_FV3LAM_wflow.sh can still be called from the command line without any arguments (since the default value of "called_from_cron" is "FALSE"). * Generalize the way commands are initialized so that any number of system scripts can be sourced in a given script (currently, only "module" is initialized). Details: * Introduce the new function init_env() that initializes the envrionment of a script by sourcing necessary system scripts. The full paths to these system scripts are specified in the array ENV_INIT_SCRIPTS_FPS in the machine files. * This function is needed because (1) this sourcing needs to be done in a couple of different scripts in the SRW App and (2) on some machines (e.g. Cheyenne), more than one system script may need to be sourced. * Use the new init_env() function in launch_FV3LAM_wflow.sh and load_modules_run_task.sh. * In load_modules_run_task.sh, init_env() replaces sourcing of only the system script that defines the "module" command. That is because on Cheyenne, in addition to the "module" command, the "qsub" command needs to be defined/initialized (by sourcing a second system script named pbs.sh). * Replace calls to "crontab -l" by echoing of already obtained contents. Fix comments and informational messages. * For Cheyenne, don't need to source two separate system scripts. Just sourcing "/etc/profile" is enough to make both the "module" and "qsub" commands (and probably all other system-supported commands) available in non-login scripts. * Make script exit with an error message if rocoto commands fail. * Fix the system script that needs to be sourced on Hera to get "module" (and other commands) to work. * In init_env.sh, declare "local" variables and change the index of the for-loop so it's different than the variable i used (and unset) by the system script on Hera. * Fix the system script that needs to be sourced on Orion to enable the "module" and other commands in a non-login bash shell. * Fix the system script on Jet that needs to be sourced to enable the "module" and other commands in a non-login bash shell. * Update comments. * Bug fix: Make sure the variable __crontab_cmd__ is defined for WCOSS_DELL_P3. * Try changing the system script to source on WCOSS_DELL_P3 to "/etc/profile" (since it works on the other machines to enable the "module" and other commands). This needs to be tested by someone who has access to WCOSS_DELL_P3. * Changes to try to make the machine file work for WCOSS_DELL_P3. Not yet tested. * Fix modulepath issue on wcoss * Fix issues on wcoss cray * Fix crontab issue on wcoss cray * Remove support for WCOSS_CRAY. * Place double qoutes around ${RUN_CMD_...} in if-statements that check whether the RUN_CMD_... variable is empty, i.e. -z "${RUN_CMD_...}". This is needed because on Cheyenne, not having the double quotes generates an error when RUN_CMD_... consists of a command that contains spaces (e.g. "mpirun -np ..."). Co-authored-by: chan-hoo <[email protected]>
- Loading branch information
1 parent
9fd0b19
commit 2684204
Showing
26 changed files
with
364 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.