Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flamenco-worker-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
blender
flamenco-worker-python
Commits
a8becd00
Commit
a8becd00
authored
7 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Add --test CLI arg and override supported task types
parent
4608cf7d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flamenco_worker/cli.py
+9
-1
9 additions, 1 deletion
flamenco_worker/cli.py
flamenco_worker/config.py
+8
-1
8 additions, 1 deletion
flamenco_worker/config.py
with
17 additions
and
2 deletions
flamenco_worker/cli.py
+
9
−
1
View file @
a8becd00
...
...
@@ -27,6 +27,10 @@ def main():
help
=
"
Enables debug logging for Flamenco Worker
'
s own log entries.
"
"
Edit the logging config in flamenco-worker.cfg
"
"
for more powerful options.
"
)
parser
.
add_argument
(
'
-t
'
,
'
--test
'
,
action
=
'
store_true
'
,
help
=
"
Starts up in testing mode, in which only a handful of
"
"
test-specific task types are accepted. This overrides the task_types
"
"
in the configuration file.
"
)
args
=
parser
.
parse_args
()
if
args
.
version
:
...
...
@@ -36,12 +40,16 @@ def main():
# Load configuration
from
.
import
config
confparser
=
config
.
load_config
(
args
.
config
,
args
.
verbose
)
confparser
=
config
.
load_config
(
args
.
config
,
args
.
verbose
,
args
.
test
)
config
.
configure_logging
(
confparser
,
enable_debug
=
args
.
debug
)
log
=
logging
.
getLogger
(
__name__
)
log
.
debug
(
'
Starting, pid=%d
'
,
os
.
getpid
())
if
args
.
test
:
log
.
warning
(
'
Test mode enabled, overriding task_types=%r
'
,
confparser
.
value
(
'
task_types
'
))
if
args
.
reregister
:
log
.
warning
(
'
Erasing worker_id and worker_secret so we can attempt re-registration.
'
)
confparser
.
erase
(
'
worker_id
'
)
...
...
This diff is collapsed.
Click to expand it.
flamenco_worker/config.py
+
8
−
1
View file @
a8becd00
...
...
@@ -28,6 +28,9 @@ DEFAULT_CONFIG = {
])
}
# Will be assigned to the config key 'task_types' when started with --test CLI arg.
TESTING_TASK_TYPES
=
'
test-blender-render
'
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -74,7 +77,8 @@ def merge_with_home_config(new_conf: dict):
def
load_config
(
config_file
:
pathlib
.
Path
=
None
,
show_effective_config
:
bool
=
False
)
->
ConfigParser
:
show_effective_config
:
bool
=
False
,
enable_test_mode
=
False
)
->
ConfigParser
:
"""
Loads one or more configuration files.
"""
# Logging and the default interpolation of configparser both use the
...
...
@@ -102,6 +106,9 @@ def load_config(config_file: pathlib.Path = None,
log
.
info
(
'
Succesfully loaded: %s
'
,
loaded
)
if
enable_test_mode
:
confparser
.
setvalue
(
'
task_types
'
,
TESTING_TASK_TYPES
)
if
show_effective_config
:
import
sys
log
.
info
(
'
Effective configuration:
'
)
...
...
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