Open stumitchell opened 1 year ago
Yes, per the discussion here, there was quite a bit of change to parameter processing when the refactor branch was merged a while back. The intent was for all command lines that worked previously to continue working in the same way. However, now that I see that the command-line you provided worked under the old parser, I'm not so sure about this. I think the intent was and still is that parameter names should always preceded by a -
. Otherwise, you cannot easily have parameters that take an optional value. Let me look at this a bit, but in the meantime, the easy workaround is just to add a -
in front of parameter names, as you already observed.
Ok great, I assume from you reply @tkralphs that 2.10.3 also accepts parameters with "-" prepended. Do I take this as a recommendation that Pulp should change its solver interface to prepend the "-" each time?
And is master safe to build from or should I go back and build a tagged release?
I looked into this a bit more and the situation is more or less as I suspected. In 2.10
, if the first string on the command line is not preceded by a -
, it is assumed to be the name of an instance file to be imported. After that, any string encountered is assumed to be a parameter name regardless. If that parameter takes an argument, then the next string is assumed to be the value to which that parameter should be set. So you cannot drop the -
in front of the parameter name if the parameter name is the first string on the command line. This means that in 2.10
cbc -import file.mps -solve
works fine, but
cbc import file.mps solve
does not. This is not so nice. Also,
cbc file.mps timeMode elapsed solve
works fine, but
cbc timeMode elapsed file.mps solve
does not. So it is a bit fragile. The fact that parameters don't need to be preceded by a -
all the time is a more or less unintended artifact of the implementation. A downside is that every command/parameter has to either always take a value or never take a value (there cannot be an assumed default).
In master, any string on the command line preceded by a -
is a command/parameter name. Any string not preceded by a -
is either the value to which the parameter preceding it should be set, or, if there is no parameter preceding it, then it is interpreted as the name of the file to be imported. So the ordering doesn't matter. The invocation
cbc file.mps -timeMode elapsed -solve
works the same as
cbc -timeMode elapsed file.mps -solve
In other words, whenever a command is expected but some other string is encountered, we just implicitly add import
as the command, regardless of where this occurs. This seems more logical and consistent to me. It means that there is no need to distinguish the first command read from other commands, which is pretty fundamental to how the new parameter parsing works. With the new parsing scheme, we can also have parameters that are called with some default if no value is specified.
Actually, I would prefer not to even have the exception for the missing import
statement, but this is there for backwards compatibility with 2.10.
Ok great, I assume from you reply @tkralphs that 2.10.3 also accepts parameters with "-" prepended. Do I take this as a recommendation that Pulp should change its solver interface to prepend the "-" each time?
Yes, adding a -
before each command/parameter name works in both and this has always been the "expected" syntax. I wasn't even aware that the -
could be dropped in some cases in 2.10.
And is master safe to build from or should I go back and build a tagged release?
Yes, it is working well, although it is (occasionally) being patched and is therefore a moving target. We haven't made a release from it yet both because the refactoring effort I started to address some recurring issues has not been completed due to a lack of manpower and because there seem to be some performance regressions from 2.10. The performance of master is improved for some particular classes of instances, but some parameter tuning is probably needed to make the performance more robust across a range of instances.
Hi all @tkralphs I have managed to compile a multithreaded windows version from master for someone. It seems to have different commandline processing previously 2.10.3 this commandline would work
now with the new build I need to add
-
to the passed optionsIs this an issue of a change in master?
Also is Master fine to build from or should I use a stable release?