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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
flamenco-worker-python
Commits
a8becd00
Commit
a8becd00
authored
Dec 14, 2017
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Add --test CLI arg and override supported task types
parent
4608cf7d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show 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():
...
@@ -27,6 +27,10 @@ def main():
help
=
"
Enables debug logging for Flamenco Worker
'
s own log entries.
"
help
=
"
Enables debug logging for Flamenco Worker
'
s own log entries.
"
"
Edit the logging config in flamenco-worker.cfg
"
"
Edit the logging config in flamenco-worker.cfg
"
"
for more powerful options.
"
)
"
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
()
args
=
parser
.
parse_args
()
if
args
.
version
:
if
args
.
version
:
...
@@ -36,12 +40,16 @@ def main():
...
@@ -36,12 +40,16 @@ def main():
# Load configuration
# Load configuration
from
.
import
config
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
)
config
.
configure_logging
(
confparser
,
enable_debug
=
args
.
debug
)
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
log
.
debug
(
'
Starting, pid=%d
'
,
os
.
getpid
())
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
:
if
args
.
reregister
:
log
.
warning
(
'
Erasing worker_id and worker_secret so we can attempt re-registration.
'
)
log
.
warning
(
'
Erasing worker_id and worker_secret so we can attempt re-registration.
'
)
confparser
.
erase
(
'
worker_id
'
)
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 = {
...
@@ -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__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -74,7 +77,8 @@ def merge_with_home_config(new_conf: dict):
...
@@ -74,7 +77,8 @@ def merge_with_home_config(new_conf: dict):
def
load_config
(
config_file
:
pathlib
.
Path
=
None
,
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.
"""
"""
Loads one or more configuration files.
"""
# Logging and the default interpolation of configparser both use the
# Logging and the default interpolation of configparser both use the
...
@@ -102,6 +106,9 @@ def load_config(config_file: pathlib.Path = None,
...
@@ -102,6 +106,9 @@ def load_config(config_file: pathlib.Path = None,
log
.
info
(
'
Succesfully loaded: %s
'
,
loaded
)
log
.
info
(
'
Succesfully loaded: %s
'
,
loaded
)
if
enable_test_mode
:
confparser
.
setvalue
(
'
task_types
'
,
TESTING_TASK_TYPES
)
if
show_effective_config
:
if
show_effective_config
:
import
sys
import
sys
log
.
info
(
'
Effective configuration:
'
)
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