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
3200929b
Commit
3200929b
authored
Dec 15, 2017
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Added support for passing Python scripts to Blender in task definitions.
parent
18dd9c70
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
flamenco_worker/commands.py
+2
-0
2 additions, 0 deletions
flamenco_worker/commands.py
tests/test_commands_blender_render.py
+38
-2
38 additions, 2 deletions
tests/test_commands_blender_render.py
with
41 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
3200929b
...
@@ -18,6 +18,7 @@ changed functionality, fixed bugs).
...
@@ -18,6 +18,7 @@ changed functionality, fixed bugs).
-
Added
`--single`
or
`-1`
CLI option to shut down the Worker after executing a single task.
-
Added
`--single`
or
`-1`
CLI option to shut down the Worker after executing a single task.
-
Added
`--test`
or
`-t`
CLI option to start in testing mode. See Flamenco documentation
-
Added
`--test`
or
`-t`
CLI option to start in testing mode. See Flamenco documentation
for more details. Requires Flamenco Manager 2.1.0+.
for more details. Requires Flamenco Manager 2.1.0+.
-
Added support for passing Python scripts to Blender in task definitions.
## Version 2.0.8 (released 2017-09-07)
## Version 2.0.8 (released 2017-09-07)
...
...
This diff is collapsed.
Click to expand it.
flamenco_worker/commands.py
+
2
−
0
View file @
3200929b
...
@@ -565,6 +565,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand):
...
@@ -565,6 +565,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand):
'
--background
'
,
'
--background
'
,
settings
[
'
filepath
'
],
settings
[
'
filepath
'
],
]
]
if
settings
.
get
(
'
python_expr
'
):
cmd
.
extend
([
'
--python-expr
'
,
settings
[
'
python_expr
'
]])
if
settings
.
get
(
'
render_output
'
):
if
settings
.
get
(
'
render_output
'
):
cmd
.
extend
([
'
--render-output
'
,
settings
[
'
render_output
'
]])
cmd
.
extend
([
'
--render-output
'
,
settings
[
'
render_output
'
]])
if
settings
.
get
(
'
format
'
):
if
settings
.
get
(
'
format
'
):
...
...
This diff is collapsed.
Click to expand it.
tests/test_commands_blender_render.py
+
38
−
2
View file @
3200929b
from
pathlib
import
Path
import
subprocess
from
unittest.mock
import
patch
,
call
from
unittest.mock
import
patch
,
call
from
test_runner
import
AbstractCommandTest
from
test_runner
import
AbstractCommandTest
...
@@ -67,8 +70,6 @@ class BlenderRenderTest(AbstractCommandTest):
...
@@ -67,8 +70,6 @@ class BlenderRenderTest(AbstractCommandTest):
def
test_cli_args
(
self
):
def
test_cli_args
(
self
):
"""
Test that CLI arguments in the blender_cmd setting are handled properly.
"""
"""
Test that CLI arguments in the blender_cmd setting are handled properly.
"""
from
pathlib
import
Path
import
subprocess
from
mock_responses
import
CoroMock
from
mock_responses
import
CoroMock
filepath
=
str
(
Path
(
__file__
).
parent
)
filepath
=
str
(
Path
(
__file__
).
parent
)
...
@@ -100,3 +101,38 @@ class BlenderRenderTest(AbstractCommandTest):
...
@@ -100,3 +101,38 @@ class BlenderRenderTest(AbstractCommandTest):
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
)
)
def
test_python_expr
(
self
):
from
mock_responses
import
CoroMock
filepath
=
str
(
Path
(
__file__
).
parent
)
settings
=
{
# Point blender_cmd to this file so that we're sure it exists.
'
blender_cmd
'
:
'
%s --with --cli=
"
args for CLI
"'
%
__file__
,
'
python_expr
'
:
'
print(
"
yay in
\'
quotes
\'
"
)
'
,
'
chunk_size
'
:
100
,
'
frames
'
:
'
1..2
'
,
'
format
'
:
'
JPEG
'
,
'
filepath
'
:
filepath
,
}
cse
=
CoroMock
(...)
cse
.
coro
.
return_value
.
wait
=
CoroMock
(
return_value
=
0
)
with
patch
(
'
asyncio.create_subprocess_exec
'
,
new
=
cse
)
as
mock_cse
:
self
.
loop
.
run_until_complete
(
self
.
cmd
.
run
(
settings
))
mock_cse
.
assert_called_once_with
(
__file__
,
'
--with
'
,
'
--cli=args for CLI
'
,
'
--enable-autoexec
'
,
'
-noaudio
'
,
'
--background
'
,
filepath
,
'
--python-expr
'
,
'
print(
"
yay in
\'
quotes
\'
"
)
'
,
'
--render-format
'
,
'
JPEG
'
,
'
--render-frame
'
,
'
1..2
'
,
stdin
=
subprocess
.
DEVNULL
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
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