BASICS: Why is there file locking and how does it work?
In CESM, there are several different $CASEROOT xml files. These include env_case.xml, env_mach_pes.xml, env_build.xml, and env_run.xml. These files are organized so variables can be locked during different phases of the case setup, build, and run. Locking variables is a feature of CESM that prevents users from changing variables after they have been resolved (used) in other parts of the scripts system. The variables in env_case are locked when create_newcase is called. The env_mach_pes variables are locked when cesm_setup is called. The env_build variables are locked when CESM is built, and the env_run variables are never locked and can be changed anytime. In addition, the Macros file is locked as part of the build step. The $CASEROOT/LockedFiles directory saves copies of the xml files to facilitate the locking feature. In summary:
-
env_case.xmlis locked upon invokingcreate_newcaseand cannot be unlocked. To change settings in env_case, a new case has to be generated with create_newcase. -
env_mach_pes.xmlare locked after runningcesm_setup. After changing variable values in this file, you need to invokedcesm_setup -cleanand thencesm_setup. -
Macrosandenv_build.xmlare locked upon the successful completion of$CASE.build. BothMacrosandenv_build.xmlcan be unlocked by invoking$CASE.cleanbuildand then the model should be rebuilt.