81 Commits

Author SHA1 Message Date
8a972972ba Fix "invalid UTF-8" test failure on Windows
On Windows an extra line "exec: Process pid=... exited with status code 0"
is reported after terminating the subprocess. This isn't relevant for
the `text_exec_invalid_utf` test, so the extra line is just ignored.

No functional changes.
2021-09-24 14:49:04 +02:00
d25d409e35 Report web-preview-friendly output when produced
When multiple versions of the same frame are generated (like EXR and
JPG), always report the most web-preview-friendly version.

In other words, when the frames are produces by Blender in the order
(`frame-001.jpg`, `frame-001.exr`), only the JPEG is reported. When the
JPEG follows the EXR, both will be reported as when the EXR is created
it is not yet know whether it will be followed by a JPEG or not.

Before this, the 2nd file would never be reported due to the Worker
throttling such reports to the Manager (to not swamp it when rendering
sequences of images, for example).
2021-07-12 13:11:52 +02:00
9cb509b10e Panic when older subprocess is detected running
Panic when an older subprocess is already running when trying to start a
new subprocess. This situation was already detected, but instead of
failing the current task (and keeping the Worker running), the Worker
now shuts down completely. When running as a systemd service, the Worker
will automatically be restarted.

When this panic occurs, the Worker still signs off at the Manager,
causing its current task to be returned to the queue. That way another
Worker (or this one, after the restart) can retry it.

This is basically a hack to work around the issue that sometimes Blender
is running twice on the same machine.
2021-07-09 14:26:50 +02:00
f5238c441d Replace some Dutch test values with some other Dutch test value 2021-07-09 14:26:50 +02:00
3e1913711c Fix compatibility with newer MyPY
No functional changes.
2021-07-09 14:26:50 +02:00
05408dc8c1 Cleanup: reformat with Black
Reformat the entire project with Black.

No functional changes.
2021-07-09 14:26:13 +02:00
3873ab06a3 Remove LD_LIBRARY_PATH environment variable for subprocess
When running Flamenco Worker from the distribution package, it actually
runs a bundled Python with its own libraries. This is done by setting the
`LD_LIBRARY_PATH` environment variable. Subprocesses inherit this variable,
causing library conflicts (mostly libz) when running Blender or FFmpeg.
2020-03-12 12:36:51 +01:00
371ccfc1ca Use tempdir in progressive render unit test
The test was failing because the directory /some couldn't be created.
2019-10-23 13:45:32 +02:00
e95d58c641 Moved self.log() from AbstractSubprocessCommand to AbstractCommand 2019-04-24 18:11:38 +02:00
f1bbfca02b Changed CRF for create_video tasks from 23 to 20
We need less compression for the Spring edit.
2019-03-13 17:11:52 +01:00
971bf62234 Use YUV420p when creating videos from images using FFmpeg
This prevents crushed blacks & highlights when using JPEG as input, as
then FFmpeg defaults to yuvj420p, which uses a 0-255 range instead of
16-235 (at least according to [1]).

[1] https://www.eoshd.com/comments/topic/20799-what-is-the-difference-between-yuvj420p-and-yuv420p/
2019-03-12 17:28:49 +01:00
60efef9df4 Translate OPEN_EXR DNA image format enum to EXR for CLI
Blender's `--render-format` CLI parameter generally takes the same names
as the `bpy.context.scene.render.image_settings.file_format` DNA parameter,
except when it comes to OpenEXR.

See https://developer.blender.org/D4502 for a proposal to make this
consistent.
2019-03-12 14:18:04 +01:00
c471a8f86b More logging to the task log, especially when killing a subprocess 2019-03-12 12:50:07 +01:00
483b99d340 Placed timing info collector in a separate class
Previously the code was spread out through the `TaskRunner` and
`AbstractCommand` classes. Now it's in a class of its own and properly
tested.

Also, the timing info is now sent as one line in the task log, making it
less spammy.
2019-02-22 10:45:04 +01:00
33325be7e7 Upload task timing metrics as part of the task update 2019-02-21 17:36:27 +01:00
d25a892557 Log command & task timing information
For now every command logs its total runtime. The `AbstractBlenderCommand`
subclasses log more granular information, like starting blender, loading
the blendfile, and rendering.

This info is just sent to the task log, and not stored in the task itself
yet.
2019-02-21 16:16:06 +01:00
c176da19a6 Remove filtering of Cycles 'Synchronizing object' lines
Nowadays we send the logs only to the Manager, and not to the Server any
more. Let's clog the Manager's harddisk with everything to make Dr. Debug
happier.
2019-02-14 12:44:21 +01:00
26701be6fb Automatically re-register when the Manager does not accept credentials
Fixes T54174, but rather than making a distinction between the username
not being found and the password being wrong (and only re-registering in
the former case), we now just always re-register. This could potentially
hide certain erroneous situations, but it does make the worker operational
in more cases, which I assume is generally preferred.
2019-02-13 10:48:38 +01:00
05b6fda873 Added merge_progressive_render_sequence command
Added the `merge_progressive_render_sequence` for sample-merging sequences of EXR files. The
already-existing `merge_progressive_renders` command only performed on one frame at a time.

This commit also removes the last traces of the preview generation that
half-happened while merging. It was intrinsincly flawed and was superseded
by the `exr_sequence_to_jpeg` command.
2019-02-05 13:04:00 +01:00
64fe38e845 Create Video: mock platform.system() to test both Windows and Linux
Windows is not POSIX-compliant, and as a result ffmpeg does not support
the `-pattern_type glob` CLI argument.
2019-02-04 11:21:56 +01:00
ef68b29493 Create Video: always pad video to even sizes
H.264 requires that the width and height of the video frame are
multiples of the chroma block size. When using the default yuv420 pixel
format this means the dimensions should be even (e.g. multiples of 2).
The video filter added in this commit ensures this by padding out the
frame with black pixels.
2019-02-04 11:15:57 +01:00
1a78a77091 EXR to JPEG: Pass EXR files as glob instead of only the directory
This allows the command to run on a subset of the EXR files in the
directory, which is needed for generating previews of EXR files in the
intermediate render directory (which contains multiple EXR files for
each frame).
2019-02-01 10:57:11 +01:00
0333804b0b Updated progressive rendering to allow sample chunk ranges
This requires Flamenco Server 2.2 or newer. Progressive render jobs
generated by older versions of Flamenco Server are no longer supported.
2019-01-31 14:18:09 +01:00
0d8f82d616 Fixed bug where uncaught exception made the Worker stop requesting tasks 2019-01-14 11:02:41 +01:00
fba56c40ec Properly create the asyncio loop on Windows
On Windows, the loop was recreated on every call to `construct_asyncio_loop()`,
whereas on Linux the existing loop would be reused if possible. Now both
platforms work the same.
2019-01-10 16:40:11 +01:00
e0ef84e6b0 Use less shell-uoting-sensitive test values
The new values work on Windows too.
2019-01-10 16:24:09 +01:00
6ad48a1e9f Disconnect from SQLite DB when tearing down tests
This allows the temp directory to be cleaned up on Windows.
2019-01-10 16:24:09 +01:00
279388e3d4 Skip unwritable dir/file checks on Windows
On Windows Python just hangs because of a misinterpretation of the
returned error. See https://bugs.python.org/issue22107
2019-01-10 16:24:09 +01:00
ca4e3ffa97 Make test file writable before trying to delete it
Otherwise Windows doesn't allow deletion.
2019-01-10 16:24:09 +01:00
478344c85c Enable debug logging in flamenco_worker.commands while testing commands 2019-01-10 16:24:09 +01:00
4a8138d17d Windows compatibility: don't try to re-open temporary file 2019-01-10 16:24:09 +01:00
3ef9175c7e Windows compatibility fixes 2019-01-10 16:24:09 +01:00
0e94bb0231 Workaround for FFmpeg not supporting '-pattern_type glob' on Windows
Globbing is the only way in which we can convert arbitrary frame sequences
to a video; the other input options all assume that the frame numbers are
sequential, and stop at the first gap. Globbing just skips gaps and
actually uses all available frames.

The workaround consist of doing the globbing in Python and creating an
index file that lists all the input files.
2019-01-10 16:24:09 +01:00
9e291e948b More Windows compatibility fixes 2019-01-10 16:23:35 +01:00
ca72d92ca7 Some Windows-specific unit test fixes 2019-01-10 13:43:34 +01:00
f1576792f1 Fixed unit test 2019-01-10 13:38:34 +01:00
6aa9c5999d Added 'create_python_file' command 2019-01-04 16:05:52 +01:00
b6ec1b8fc3 Detect & load RNA overrides file
The 'blender_render' and 'blender_render_progressive' commands now look for
a file named 'thefile-overrides.py' in the same directory as
'thefile.blend'. If it exists, Blender will be told to load that Python
file between loading the blend file and starting the rendering.
2019-01-04 16:05:52 +01:00
5cf23b76f6 Updated test with new FFMPEG settings for 'create video' command 2019-01-04 15:46:14 +01:00
6477e908d1 Added support for commands used in the blender-video-chunks job type
Adds the following commands:

    - blender_render_audio
    - concat_videos
    - create_video
    - move_with_counter
    - mux_audio
2018-12-07 11:25:07 +01:00
05ec19b053 Explicitly return task to the Manager queue when stopping the task
This should solve issues when tasks fail after the worker shuts down or
goes to sleep. Previously the task would be set to 'claimed-by-manager'
when the Worker when to sleep, but flushing the task queue on the Worker
could still trigger reactivation of the task on the Manager. Since the
Worker wouldn't be running the task any more, it would time out. This is
now fixed.
2018-12-04 16:29:32 +01:00
2a0790617c Pass FFmpeg binary as ffmpeg_cmd and split the command
This is for consistency with the `blender_cmd` setting of Blender render
commands. The splitting is done so that extra CLI commands can be given
in the Manager config.
2018-11-23 16:12:38 +01:00
d2e3791cbe Added command 'create_video' to run FFmpeg
This requires FFmpeg to be installed (not just for the command, but also
for running the accompanying unit test). Because of this external
dependency, the worker has to declare task_type='video-encoding' in its
configuration file before it gets such tasks. This is not enabled by
default.
2018-11-22 16:09:57 +01:00
feace5409f Added MyPy runner to unit tests 2018-11-22 16:09:57 +01:00
421ec4b658 Only stop task if task-to-stop is the same as currently-executing-task
The 'may-i-run' endpoint may say 'no' to us running task X, but when the
response comes in and is handled the worker may already be working on task
Y. This case is now recognised, and the 'no' will be ignored.
2018-11-16 15:45:39 +01:00
9978f280bf Include proper PIDs in unit tests 2018-11-15 13:52:15 +01:00
a350ed2e5a Absolute imports for tests to make PyCharm happy 2018-11-15 13:52:05 +01:00
6acbc2cc25 Fix logging failed command 2018-11-15 12:43:22 +01:00
3a218da3cb Fixed race condition in subprocess PID file handling
This doesn't fix the root cause for multiple subprocesses running, but it
does kill better when it finds another subprocess in a race condition.
2018-11-15 12:13:51 +01:00
826f53b345 Changed from 'task' to 'future'
This makes a clearer distinction between Flamenco tasks ('task') and
AsyncIO tasks ('future'). The AsyncIO Task class is a subclass of its
Future class.
2018-11-15 11:43:37 +01:00