76 Commits

Author SHA1 Message Date
Sybren A. Stüvel
e9212de196 Worker: simplify "context done" checks 2022-04-09 16:57:39 +02:00
Sybren A. Stüvel
d98dbaa333 Worker: implement ffmpeg for frame-to-video conversion on Windows 2022-04-09 16:20:29 +02:00
Sybren A. Stüvel
38aedfe8cc Worker: make blender-finder find blender.exe and not blender-launcher.exe
`blender-launcher.exe` doesn't pipe Blender's stdout/stderr output, so it's
not useful for Flamenco.
2022-04-09 16:16:19 +02:00
Sybren A. Stüvel
0959179225 Worker: redirect stderr to stdout at the right moment
It should be done after stdout has been assigned a pipe, and not before.
2022-04-09 16:14:44 +02:00
Sybren A. Stüvel
4181708709 Worker: automatically find Blender on Windows via file association
On Windows, when the Manager doesn't explicitly point at a Blender to use,
use the the application associated with `.blend` files instead.
2022-04-09 15:05:34 +02:00
Sybren A. Stüvel
bf47afc32b Worker: reduce log level of "fetching tasks" message 2022-04-09 12:52:28 +02:00
Sybren A. Stüvel
cc20b850ec Worker: separate contexts of upstream buffer
The upstream buffer takes care of two things: communication with Flamenco
Manager (first context) and buffering things in a SQLite database (second
context). This commit separates those two contexts, so that shutting down
the application isn't going to prevent buffering things in the database.
2022-04-08 16:49:53 +02:00
Sybren A. Stüvel
e7fc2c6f6e Worker: add various extra error checks 2022-04-08 14:47:20 +02:00
Sybren A. Stüvel
1960b668aa Cleanup: remove unused code 2022-04-08 14:47:07 +02:00
Sybren A. Stüvel
62ea7dcf1d Worker: avoid task errors on shutdown
When shutting down, the main worker context closes. This causes the
subprocess to be killed, which in turn caused a task execution error. This
now no longer happens, as such errors are expected on shutdown and do not
indicate task failure.
2022-04-08 14:32:25 +02:00
Sybren A. Stüvel
fdab07d987 Worker: slight clarification of error message 2022-04-05 16:28:22 +02:00
Sybren A. Stüvel
781f1d936a OAPI: add jobs query endpoint 2022-04-04 18:53:19 +02:00
Sybren A. Stüvel
bff5e30421 Worker: use defaults for partial configuration
Instead of having a full "defaults OR the loaded config" (where a partial
config file would thus have the nil value for missing properties) the
missing properties now retain their default value.
2022-04-04 16:56:52 +02:00
Sybren A. Stüvel
21227c8046 More Shaman integration work
- Addon switches between filesystem-packing and Shaman-packing
  automatically, depending on whether the Manager has Shaman enabled.
- Actually using BAT for Shaman packing.

It doesn't work though, some error occurs when receiving Shaman response
from the Manager in the Addon.
2022-03-25 14:10:26 +01:00
Sybren A. Stüvel
b2288e7f28 Manager: More work on Shaman support
This introduces some more conceptual changes to Shaman. The most important
one is that there is no longer a "checkout ID", but a "checkout path".
The Shaman client can request any subpath of the checkout directory,
so that it can handle things like project- or scene-specific prefixes.
2022-03-25 14:10:26 +01:00
Sybren A. Stüvel
4df0543661 Manager: Implementation of Shaman OAPI interface
This hooks up the OpenAPI Shaman endpoints to a Shaman interface. This
interface doesn't have any implementation yet.
2022-03-25 14:10:26 +01:00
Sybren A. Stüvel
b6a7a15582 Implement frames-to-video command
This finishes the "Simple Blender Render" job type, as it can now be run
fully by a Worker!
2022-03-17 16:18:10 +01:00
Sybren A. Stüvel
5ea3bfe301 Worker: reduce logging 2022-03-17 15:39:59 +01:00
Sybren A. Stüvel
c989bce51e Implement move-directory command, and use it in Simple Blender Render 2022-03-17 15:39:52 +01:00
Sybren A. Stüvel
1bcf4139bf Worker: be a bit faster in requesting a new task 2022-03-17 13:07:48 +01:00
Sybren A. Stüvel
afc6b8e1c5 Worker: add -find-manager CLI arg
With `-find-manager` the Worker will use UPnP/SSDP autodiscovery, report
which Manager it found, and quit.
2022-03-11 10:52:03 +01:00
Sybren A. Stüvel
842255a065 UPnP/SSDP: actually serve a description.xml
The `description.xml` file is part of the UPnP Service Discovery protocol,
see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rxad/9225d145-6b2c-40d5-8ee8-7d837379fc25
2022-03-08 17:25:49 +01:00
Sybren A. Stüvel
353da58ee9 UPnP/SSDP: reduce log level for unreachable URLs 2022-03-08 16:46:14 +01:00
Sybren A. Stüvel
a61e3ca6f7 Worker tests: use in-memory SQLite database 2022-03-08 15:03:03 +01:00
Sybren A. Stüvel
fabb79e583 Worker: move autodiscovery code into the 'worker' package
Move the UPnP/SSDP Manager autodiscovery code into from `main.go` into the
`worker` package. This also means changing the error handling a bit, as
only the `main.go` file is allowed to do `log.Fatal()`.
2022-03-08 14:41:30 +01:00
Sybren A. Stüvel
d0b677ffe3 Add API endpoint /api/version to get the Flamenco Manager version
This will be used in the auto-discovery, to check that a discovered URL can
actually be reached & points to a Flamenco Manager.
2022-03-08 13:56:43 +01:00
Sybren A. Stüvel
42407865eb Worker: change how configuration & credentials are loaded/saved
The Worker config/credential management was a bit of a mess. It's now
better structured, and also allows runtime overrides of the Manager URL,
without writing that override to the config file.
2022-03-08 13:51:03 +01:00
Sybren A. Stüvel
9f5e4cc0cc License: license all code under "GPL-3.0-or-later"
The add-on code was copy-pasted from other addons and used the GPL v2
license, whereas by accident the LICENSE text file had the GNU "Affero" GPL
license v3 (instead of regular GPL v3).

This is now all streamlined, and all code is licensed as "GPL v3 or later".

Furthermore, the code comments just show a SPDX License Identifier
instead of an entire license block.
2022-03-07 15:26:46 +01:00
Sybren A. Stüvel
183bb23d2a Tests: sleep test using bigger time steps
Since every mocked clock time step also waits for 1ms to give other
goroutines a chance to run, it took too much wallclock time to mock-sleep
for 47 seconds with 100ms increments.

Stepping the mocked clock with 1s increments makes the test 10x faster.
2022-03-04 12:35:01 +01:00
Sybren A. Stüvel
cd2fe8170e Errors: remove "error" prefix from message
Instead of returning an error "error doing X", just return "doing X". The
fact that it's returned as an error object says enough about that it's
an error.

This also makes it easier to chain error messages, without seeing the
word "error" in every part of the chain.
2022-03-04 11:30:31 +01:00
Sybren A. Stüvel
a7654394b4 Worker: update default task types to match what's currently in use
Flamenco v2 had a different classification of task types than Flamenco v3,
and the defaults still referenced the v2 classifications.
2022-03-03 11:51:53 +01:00
Sybren A. Stüvel
47e36c927c Change package URL to the blender.org repository 2022-03-01 20:45:09 +01:00
Sybren A. Stüvel
b5b7b228ed Worker: capture panics in 'active' state and cleanly sign off before dying 2022-02-28 12:07:10 +01:00
Sybren A. Stüvel
2a1f5a0df4 Worker: buffer task updates when Manager offline
Queue task updates in an SQLite database when the Manager is
unreachable, periodically checking whether they can be flushed.
2022-02-22 19:05:33 +01:00
Sybren A. Stüvel
e948c5d936 Worker: avoid prematurely exiting 'awake' state 2022-02-22 19:01:01 +01:00
Sybren A. Stüvel
5c3a5124f3 Cleanup: add missing comment 2022-02-22 19:00:44 +01:00
Sybren A. Stüvel
b462e8db1a Worker: wrap api.ClientWithResponsesInterface in a local interface
This makes it possible to locally create a mock object for the API client.
2022-02-22 17:13:04 +01:00
Sybren A. Stüvel
a650aa4cbd Worker: Blender command, don't put current time in log lines
The time has to be put in at a different abstraction level.
2022-02-22 15:36:20 +01:00
Sybren A. Stüvel
adf7113b34 Worker: log chunker, also flush log after certain time
This flushes the log when the previous `Append()` call was too long ago.
Note that this doesn't flush after X seconds of silence; a call to
`Append()` or `Flush()` still has to happen in order to do the flushing.
2022-02-22 15:34:37 +01:00
Sybren A. Stüvel
45a95ca4c2 Worker: use time service to log current time 2022-02-22 15:33:30 +01:00
Sybren A. Stüvel
66186e460e Worker: upload logs in chunks to Manager 2022-02-22 15:17:35 +01:00
Sybren A. Stüvel
9a5047a94d Worker: move command_exe.go interface definitions 2022-02-22 14:42:57 +01:00
Sybren A. Stüvel
0525bd726c Worker: actually execute blender and log its output 2022-02-22 13:55:28 +01:00
Sybren A. Stüvel
32c7a1fd84 Worker: Blender command, parse CLI arguments from 'exe' parameter 2022-02-22 12:52:16 +01:00
Sybren A. Stüvel
db4505e5fd Cleanup: move Blender command param parsing to its own function 2022-02-22 12:38:25 +01:00
Sybren A. Stüvel
20965691d0 Add test for Blender command and better command parameter parsing 2022-02-22 12:36:37 +01:00
Sybren A. Stüvel
e9a94eecae Worker: add CLI runner interface and move test/mock code around a bit 2022-02-22 12:35:43 +01:00
Sybren A. Stüvel
77f1e02c75 Worker: add CommandLineRunner interface for executing CLIs
Not yet used, but interface is there + mocked for testing.
2022-02-22 11:48:29 +01:00
Sybren A. Stüvel
b986fa49d8 Worker: clean up some logging 2022-02-21 19:07:20 +01:00
Sybren A. Stüvel
e5e466931b Worker: better way to get array command parameters 2022-02-21 18:04:17 +01:00