Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Load parameters from ENV #557

Open
JensHeinrich opened this issue Aug 5, 2020 · 4 comments
Open

Feature Request: Load parameters from ENV #557

JensHeinrich opened this issue Aug 5, 2020 · 4 comments
Assignees

Comments

@JensHeinrich
Copy link

Load the parameters from the ENV, if they are defined to provide an easier handling.

@kba
Copy link
Member

kba commented Aug 6, 2020

IIUC you mean parameters in the sense of command line flags, options and arguments, right? E.g. that

OCRD_INPUT_FILE_GRP=MAX \
OCRD_OUTPUT_FILE_GRP=BIN \
OCRD_OVERWRITE=true \
ocrd-olena-binarize

would be equivalent to

ocrd-olena-binarize -I MAX -O OUT --overwrite

Correct?

@mikegerber
Copy link
Contributor

mikegerber commented Aug 7, 2020

Not sure what @JensHeinrich meant but I found myself often wanting to configure options for the processors, e.g. reduce this:

ocrd workspace validate --skip dimension --skip pixel_density --page-strictness lax --page-coordinate-consistency off
ocrd-calamari-recognize --overwrite -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI -P checkpoint "/var/lib/calamari-models/GT4HistOCR/2019-07-22T15_49+0200/*.ckpt.json" -P textequiv_level "$TEXTEQUIV_LEVEL"

to

ocrd workspace validate
ocrd-calamari-recognize -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI

(Side note: validate does not seem to conform to the JSON/-P parameter convention. Is it intentional?)

I would certainly welcome

  1. another way to straightforwardly specify -p/-P parameters by way of environment variables e.g. OCRD_CALAMARI_PARAMETERS="-P textequiv_level glyph -P foo bar"
  2. Allowing stuff like --overwrite or --skip pixel_density to be defined by -P-parameters
  3. Make globally available parameters like --overwrite configurable globally, e.g. OCRD_GLOBAL_PARAMETERS="-P overwrite true"

All proposed solutions and syntaxes here are just what I came up with in 5 minutes and should be discussed more. (Problems I see: How do I remove a env-specified parameter? Overriding seems easily done though, CLI parameter beats env parameter.)

@JensHeinrich
Copy link
Author

JensHeinrich commented Aug 7, 2020

Yep, would also go for

explicit (command line flag)
>
implicit (env)
>
standard (config file) (should a static config file be added anywhere in the future)

(This is also how for example the ansible project treats this)

@mikegerber unset PARAM should do the job for deleting

Tbh I am mostly just doing the in-house support for our pilot, but having to specify the same options over and over again makes me want to help people

Probably namespacing them like @mikegerber specified in the 1. solution is a good idea

And a global namespace like in 3. Too

@bertsky
Copy link
Collaborator

bertsky commented Aug 14, 2020

#376 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants