← Back to team overview

dolfin team mailing list archive

Re: [Bug 452950] [NEW] Parsing command line options for several parameters fails

 

On Mon, Oct 19, 2009 at 11:42:09AM -0000, Johan Hake wrote:
> On Monday 19 October 2009 13:28:36 logg wrote:
> > On Fri, Oct 16, 2009 at 10:11:55AM -0000, Johan Hake wrote:
> > > Public bug reported:
> > >
> > > A user cannot send command line options to both PETSc and a user defined
> > > parameters
> > >
> > >    ./app --petsc.foo --petsc.bar --my_foo bar
> > >
> > > Reproduce error:
> > > Save the following in a file parameter_fail.py
> > >
> > > *********************************************
> > > from dolfin import *
> > >
> > > par = Parameters("app_par", bar="foo")
> > >
> > > parameters.parse()
> > > par.parse()
> > > *********************************************
> > >
> > > and run it from the prompt using
> > >
> > >     python parameter_fail.py  --petsc.mat_view_draw --bar=baz
> > >
> > > ** Affects: dolfin
> > >      Importance: Undecided
> > >          Status: New
> >
> > Should we make the parse() command just parse the parameter it knows
> > and ignore others?
>
> Good question. I have thought of this too. The nice thing with a complaining
> parser is that we get notice when we type an error.
>
> Another way is to always check for dolfin. and petsc. parameters and just
> ignore them while parsing ordinary parameters, and ignore all other when
> parsing the global parameters.
>
> Not sure what's most intuitive and correct.

I suggest we start with the simplest option which is to do the same
thing in both cases (not complain).

We could perhaps be verbose when we parse parameters:

  Parsing command-line parameter "foo" with value 1.0.
  Parsing command-line parameter "bar" with value "xxx".
  Passing command-line option "..." to PETSc.
  Ignoring unknown command-line option "...".

--
Anders

-- 
Parsing command line options for several parameters fails
https://bugs.launchpad.net/bugs/452950
You received this bug notification because you are subscribed to DOLFIN.

Status in DOLFIN: New

Bug description:
A user cannot send command line options to both PETSc and a user defined parameters

   ./app --petsc.foo --petsc.bar --my_foo bar

Reproduce error:
Save the following in a file parameter_fail.py 

*********************************************
from dolfin import *

par = Parameters("app_par", bar="foo")

parameters.parse()
par.parse()
*********************************************

and run it from the prompt using

    python parameter_fail.py  --petsc.mat_view_draw --bar=baz


Follow ups

References