Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
UW-Glance
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eva Schiffer
UW-Glance
Commits
fd96b046
Commit
fd96b046
authored
3 years ago
by
Eva Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
warn the user if we're discarding their command line input in favor of a config file
parent
943ffdc2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyglance/glance/config_organizer.py
+30
-3
30 additions, 3 deletions
pyglance/glance/config_organizer.py
with
30 additions
and
3 deletions
pyglance/glance/config_organizer.py
+
30
−
3
View file @
fd96b046
...
...
@@ -321,8 +321,32 @@ def _import_module(full_name, full_file_path,) :
spec
.
loader
.
exec_module
(
mod
)
return
mod
# TODO, right now this is the top level function that the library functions in
# compare.py call
# FUTURE, if we update the things that could be stomped from the command line, we have to update this as well, sadly
# the key here is the option key we expect in the optionSet and the value is the default value
_STOMPABLE_OPTIONS
=
{
EPSILON_KEY
:
0.0
,
OPTIONS_FILL_VALUE_KEY
:
None
,
OPTIONS_LAT_VAR_NAME_KEY
:
'
pixel_latitude
'
,
OPTIONS_LON_VAR_NAME_KEY
:
'
pixel_longitude
'
,
OPTIONS_LONLAT_EPSILON_KEY
:
0.0
,
OPTIONS_IMAGES_ON_FAIL_KEY
:
False
,
DO_MAKE_FORKS_KEY
:
False
,
}
def
_warn_for_stomped_commandline_options
(
optionSet
)
:
"""
Given the optionSet that the user
'
s input created, warn them if a config file is going to stomp some of these
"""
for
option_key
in
sorted
(
_STOMPABLE_OPTIONS
.
keys
())
:
if
(
option_key
in
optionSet
and
optionSet
[
option_key
]
is
not
None
and
optionSet
[
option_key
]
!=
_STOMPABLE_OPTIONS
[
option_key
]
)
:
LOG
.
warn
(
"
User provided input for the option
\"
"
+
option_key
+
"
\"
on the command line that
"
"
will be overridden by the requested config file.
"
"
This part of the command line input will be ignored.
"
)
LOG
.
debug
(
"
User value for
"
+
option_key
+
"
:
"
+
str
(
optionSet
[
option_key
]))
# TODO, right now this is the top level function that the library functions in compare.py call
def
load_config_or_options
(
aPath
,
bPath
,
optionsSet
,
requestedVars
=
[
])
:
"""
load information on how the user wants to run the command from a dictionary of options
...
...
@@ -368,7 +392,10 @@ def load_config_or_options(aPath, bPath, optionsSet, requestedVars = [ ]) :
else
:
LOG
.
info
(
"
Using Config File Settings
"
)
# if the user entered stuff in the command line options that we're going to be ignoring, let's warn them
_warn_for_stomped_commandline_options
(
optionsSet
)
# this will handle relative paths
requestedConfigFile
=
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
requestedConfigFile
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment