- removed comment
When calling sim setup on a machine in the machine data base (eg bluewaters in my case) it it still creates only a [default] section in defs.local.ini which means that the account information and possibly non-default sourcebasedir are not used for bluewaters leading to hard to understand error messages later on.
I would thus like to suggest to change sim setup such that instead (or in addition to) a "[default]" section it creates a section for the detected machine if it already knows this machine.
Keyword:
Unfortunately, modifying "sim setup" is very awkward. Instead of direct python code which asks questions and sets up a data structure which is eventually written to defs.local.ini, which would be easy to modify, the questions and actions are defined in terms of a "decision tree" via configuration files. This means that adding logic which was not originally intended to the setup process requires the additional step of adding such logic to the generic decision tree language, then implementing the change in the configuration file. "sim setup" starts off in sim-util.py in command_setup, where we have
Here, "defaults" refers to the file lib/dt/defaults.ini, which contains the configuration for the "defaults" decision tree. It contains things like
which means that the code should ask for the local machine name, then execute a "macro" called GET_LOCAL_MACHINE_NAME (maybe for the default?), then store the result in a section of the ini file, expanded as @..@. I'm not sure which machine is referred to here.
Anyway, there is a facility for setting machine-specific options; this is the question at the end of the setup process which asks if you want to set explicit machine-specific options. One way to work around the current problem would be to ask users to set up their sourcebasedir here, but this is obviously suboptimal.
Perhaps what we want is to copy all the settings from [default] to [<machine>] after the setup process completes (though presumably not overriding any which had been explicitly set by the user). If we could access the ini file from command_setup, we might be able to try this, but by the time dt.begin() exits, the file has already been written. There's also no way to hook in to the system between writing the [defaults] and [<machine>] sections.
In the spirit of the original code, we probably want a concept of copying everything that was set in one part of the decision tree ([default]) into another part ([<machine>]).
One suggestion would be to replace the entire "sim setup" code with a simpler implementation. Unless I am missing something, it seems like it should be less than a couple of pages of code. We might lose some "advanced" functionality, but I suspect we don't use that functionality anyway.
Is anyone already familiar with this code, and would like to take a stab at fixing the problem in a way which is consistent with the original implementation? Erik?