448 Commits

Author SHA1 Message Date
Sybren A. Stüvel
2927e82802 Swagger UI: remove the "try it out" buttons
Remove the "try it out" buttons, and have the "Execute" buttons visible
immediately.
2023-02-03 13:40:26 +01:00
Sybren A. Stüvel
3bedc2c87a Swagger UI: add "Back to Flamenco" link
Add a link from the API section to the main Flamenco web interface.
2023-02-03 13:40:22 +01:00
Sybren A. Stüvel
a97a4e6e67 Manager: show delete-requested jobs in the web interface
Show jobs that have been marked for deletion with a red strike-through
line in the jobs table, and show the deletion-request timestamp in the
job details.
2023-01-08 13:52:27 +01:00
Sybren A. Stüvel
416138fd70 Manager: add test for QueryJobs() API function
No functional changes.
2023-01-08 13:15:30 +01:00
Sybren A. Stüvel
791d877ff1 Manager: implement API endpoint for deleting jobs
Implement the `deleteJob` API endpoint. Calling this endpoint will mark
the job as "deletion requested", after which it's queued for actual
deletion. This makes the API response fast, even when there is a lot of
work to do in the background.

A new background service "job deleter" keeps track of the queue of such
jobs, and performs the actual deletion. It removes:

- Shaman checkout for the job (but see below)
- Manager-local files of the job (task logs, last-rendered images)
- The job itself

The removal is done in the above order, so the job is only removed from the
database if the rest of the removal was succesful.

Shaman checkouts are only removed if the job was submitted with Flamenco
version 3.2. Earlier versions did not record enough information to reliably
do this.
2023-01-04 01:18:21 +01:00
Sybren A. Stüvel
f413a40f4e Store Shaman checkout ID when submitting a job
If Shaman is used to submit the job files, store the job's checkout ID
(i.e. the path relative to the checkout root) in the database. This will
make it possible in the future to remove the Shaman checkout along with
the job itself.
2023-01-04 01:18:21 +01:00
Sybren A. Stüvel
6aea02c904 Fix T103516: max image size for previews is set too low
Manager had a limit of 10 MB, but the Worker can produce images that are
larger than that (even after down-scaling the image). I've bumped the
limit to 25 MB, which should be enough (it's 2x the bug reporter's file
size).
2023-01-03 16:28:28 +01:00
Sybren A. Stüvel
2df5a1089a Fix T102707: Flamenco Manager crash on frame range without hyphen
The "invalid range" error reporting had an infinite loop, causing a crash.
This is now resolved.
2023-01-03 16:16:44 +01:00
Sybren A. Stüvel
9bda21648e Manager: add timeout when fetching job
Add a timeout when fetching a job from the persistence layers.

It's my intention to add more timeouts, so this also introduces some code
to make it easier to test that a context has a deadline set.
2022-12-14 13:02:59 +01:00
Sybren A. Stüvel
c16c1f4b15 Refactor: deduplicate job fetching code
Deduplicate API implementation code to fetch a job from the persistence
service.

Almost no functional changes. Checking that the requested job UUID is
actually a valid UUID is now consistently done on all fetches. This is
not a functional change in normal Flamenco operations, where only valid
UUIDs are used anyway.
2022-12-14 13:02:59 +01:00
Sybren A. Stüvel
15e3745820 Manager: SQLite WAL journal + NORMAL sync mode
Run `PRAGMA journal_mode = WAL` and `PRAGMA synchronous = normal` when
connecting to the SQLite database. This enables the write-ahead-log journal
mode, which makes it safe to enable "normal" synchronisation (instead of
the default "full" synchronisation).
2022-11-24 17:18:06 +01:00
Sybren A. Stüvel
982dca0d4e Fix FFmpeg wanting to use JPEG files when rendering PNG
The preview video task would attempt to use JPEG preview files when the
"Preview" checkbox is checked, even when this checkbox is not shown in
Blender's UI (when the output format is not EXR). Blender still stores
this property, even when it's unused, and that's what tripped up the job
compiler.

The "Simple Blender Render" job type now first checks whether the previews
are necessary at all, and only then uses them.
2022-11-10 14:10:03 +01:00
Sybren A. Stüvel
7a60bb70e0 Manager: implement job check endpoint 2022-10-20 13:13:35 +02:00
Sybren A. Stüvel
73dd8c7d78 Cleanup: pass submittedJob as pointer to two-way variable replacer
The two-way variable replacement function changes the submitted job. To
clarify that this happens, pass the pointer `&submittedJob`.

Both pass-by-pointer and pass-by-value work, because the variable
replacement typically works on maps/slices, which are passed by reference
anyway. Better to be explicit about this, though.

No functional changes.
2022-10-20 12:55:01 +02:00
Sybren A. Stüvel
e77bd9b841 Fix workers immediately switching state on a lazy request
Fix an issue where workers would switch immediately on a state change
request, even if it was of the "after task is finished" kind.

The "may I keep running" endpoint wasn't checking the lazyness flag, and
thus any state change, lazy or otherwise, would interrupt the worker's
current task.
2022-10-20 12:30:37 +02:00
Sybren A. Stüvel
ad0fea241d Simple blender render: hide has_previews from web interface
It was useful for debugging, but not really needed for artists.
2022-10-20 12:18:00 +02:00
Sybren A. Stüvel
f1c4211d2b FFmpeg preview video: add missing switch to .jpg extension
One line was missing from rF43bc22f10fae.
2022-10-20 12:17:34 +02:00
Sybren A. Stüvel
43bc22f10f Generate preview video from Blender-generate EXR preview JPEGs
If Blender is configured to store a preview-JPEG next to rendered EXR
files, feed those previews to FFmpeg to generate the preview video.
2022-10-20 12:10:32 +02:00
Sybren A. Stüvel
85d53de1f9 Manager: implement API endpoint for changing job priority
The priority of an existing can now be changed. It will be taken into
account when assigning tasks to workers, but it will not reassign tasks
that are already active.
2022-09-30 16:30:03 +02:00
Sybren A. Stüvel
59655ea770 Manager: fix error in sleep scheduler when shutting down
When the Manager was shutting down while the sleep scheduler was running, it
could cause a null pointer dereference. This is now doubly solved:

- `worker.Identifier()` is now nil-safe, as in, `worker` can be `nil` and
  it will still return a sensible string.
- failure to apply the sleep schedule due to the context closing is not
  logged as error any more.
2022-09-27 12:27:18 +02:00
Sybren A. Stüvel
759a94e49b Blender finder: also handle exec.ErrNotFound as "expected"
Blender not being found can be reported via various errors (this should be
reworked in the 'blender finder API' at some point). `exec.ErrNotFound` is
returned when Blender cannot be found on `$PATH`, which is something that's
absolutely fine. This is now logged less dramatically.
2022-09-22 12:39:40 +02:00
Sybren A. Stüvel
161a7f7cb3 Less dramatic logging when Blender cannot be found
Avoid the word "error" in logging when Blender cannot be found. Typically
these are warnings, and having the word "error" there makes people think
otherwise.
2022-09-22 12:37:46 +02:00
Sybren A. Stüvel
1ffd56939a Manager: match Windows paths in two-way variables also with slashes
When doing two-way variable replacement, if the variable has a Windows
path (i.e. backslashes) also do a match for the value with forward slashes.

In other words, if a path `Y:/shared/...` comes in, and the variable value
is (correctly) `Y:\shared\...`, it will be seen as a match.
2022-09-01 15:27:31 +02:00
Sybren A. Stüvel
8368feebac Fix unit test
The recent change in error message caused a test to fail, this is now
fixed. No functional changes.
2022-09-01 15:17:04 +02:00
Sybren A. Stüvel
46792ee164 Clarify "job etag mismatch" situation
When a submitted job is refused because of a mismatched etag, there is
now a more explanatory error logged on the Manager. The website also has
an entry in the FAQ for this, as I expect more people to run into this
issue when they upgrade Flamenco.
2022-09-01 14:46:30 +02:00
Sybren A. Stüvel
780a9f9ef6 Refactor some tests to use require. instead of assert. + fail
The `require.XXX` functions are exactly the same as `assert.XXX`
functions + directly failing the test, so this refactor simplifies the
code quite a bit. Can be done in more areas than this.

No functional changes.
2022-08-31 17:28:19 +02:00
Sybren A. Stüvel
0afde53209 Simple Blender Render: no longer render to intermediate directory
Simple Blender Render now no longer renders to an intermediate directory.
This not only simplifies the script, but it also opens the door for
selective re-running of individual tasks.

In the old situation, where the intermediate directory was renamed to
the desired name in the last task, rerunning tasks would fail because the
directory they expect to exist no longer exists. This is now resolved.
2022-08-31 17:24:31 +02:00
Sybren A. Stüvel
f065cda830 Cleanup: remove some debug prints from Simple Blender Render script 2022-08-31 16:25:52 +02:00
Sybren A. Stüvel
2e1c0b83bf Simple Blender Render: refuse to render videos
The original idea behind this job type was that it would work equally
well for videos as for images, but that was never really well tested.
It's currently broken, so this commit removes video support altogether.
2022-08-31 16:25:23 +02:00
Sybren A. Stüvel
eb89984db8 Simple Blender Render: remove blender_cmd setting
Remove the `blender_cmd` setting, and just hard-code it to `{blender}`.
The Blender add-on was already passing this string, and it's very unlikely
that people are already writing custom add-ons to pass something different.
It provided flexibility that was untested, so it's better to simplify
things.
2022-08-31 16:24:34 +02:00
Sybren A. Stüvel
25dd7b214b Manager: remove superfluous "error compiling job: " prefix from message
The wrapped error already mentioned it was about job compilation.
2022-08-31 16:23:10 +02:00
Sybren A. Stüvel
31cf0a4ecc Implement getSharedStorage operation & use it in the add-on
Implement the `getSharedStorage` operation in the Manager, and use it in
the add-on to get the shared storage location in a way that makes sense
for the platform of the user.

Manifest task: T100196
2022-08-31 11:44:37 +02:00
Sybren A. Stüvel
31769bcdf2 Manager: always set config.currentGOOS
This variable is used in tests to mock the current OS, but wasn't set
during normal operation of the Manager. This caused issues with the
two-way variable system.
2022-08-31 11:43:28 +02:00
Sybren A. Stüvel
2eae682b9a Manager: actually return the short version in the GetVersion operation 2022-08-31 08:58:59 +02:00
Sybren A. Stüvel
ab14c97b2e Manager: fix tests on Windows
Fix some tests that were failing because some parts of Flamenco now use
native path separators instead of always-forward ones.
2022-08-30 15:44:14 +02:00
Sybren A. Stüvel
e5a20425c4 Separate variables for Blender executable and its arguments.
Split "executable" from "its arguments" in blender & ffmpeg commands.

Use `{blenderArgs}` variable to hold the default Blender arguments,
instead of having both the executable and its arguments in `{blender}`.

The reason for this is to support backslashes in the Blender executable
path. These were interpreted as escape characters by the shell lexer.
The shell lexer based splitting is now only performed on the default
arguments, with the result that `C:\Program Files\Blender
Foundation\3.3\blender.exe` is now a valid value for `{blender}`.

This does mean that this is backward incompatible change, and that it
requires setting up Flamenco Manager again, and that older jobs will not
be able to be rerun.

It is recommended to remove `flamenco-manager.yaml`, restart Flamenco
Manager, and reconfigure via the setup assistant.
2022-08-30 14:58:16 +02:00
Sybren A. Stüvel
c504e68d8e Manager: store the jobs implicit variable in platform-native notation
Don't change backslashes to forward slashes on Windows. Trying to use
forward slashes everywhere was a mistake, and this is one of the steps to
make it right.
2022-08-29 17:51:20 +02:00
Sybren A. Stüvel
20395e0e26 Manager: always start the variable lookup table with a fresh map
If the loaded config doesn't define the default variables, the latter
should not be found in the lookup table any more; this is now fixed.
2022-08-29 17:44:47 +02:00
Sybren A. Stüvel
4a201d47b4 Cleanup: add unit test for parsing backslashes in variable values
Backslashes can be included in two ways, as-is (which works fine) and
between double quotes (in which case they need escaping). This test checks
for both.
2022-08-29 17:28:40 +02:00
Sybren A. Stüvel
0c91fe93d0 Manager: only do pathsep localisation on two-way variables
By accident the Manager was performing slash localisation on all
command parameters, causing some math expressions for FFmpeg to fail.
2022-08-25 15:02:56 +02:00
Sybren A. Stüvel
6b4b205c1c Manager: allow backslashes in variables
Windows machines should be able to simply use backslashes.
2022-08-25 13:59:02 +02:00
Sybren A. Stüvel
22aa041ec1 Allow relative render output root paths
Add a new `abspath(path)` function to the add-on, for use in job type
settings. With this, the "simple blender render" job can support relative
paths for the "render output root" setting, and still have an absolute
final "render output path".
2022-08-25 13:14:48 +02:00
Sybren A. Stüvel
63c60a5b15 Two-way variable replacement: change path separators to target platform
Two-way variable replacement now also changes the path separators. Since
the two-way replacement is made for paths, it makes sense to also clean up
the path for the target platform.
2022-08-25 12:19:30 +02:00
Sybren A. Stüvel
2a345a3d2c API for deleting workers
Workers can now be soft-deleted. Tasks assigned to the worker will remain
associated with that Worker. Active tasks will be re-queued so other
workers can pick them up.
2022-08-11 16:59:53 -07:00
Sybren A. Stüvel
cbafe0ff34 Manager: when finding Blender, be less dramatic when it can't be found
It's fine when Blender is not available on `$PATH`, so only log that at
debug level.
2022-08-02 13:36:25 +02:00
Sybren A. Stüvel
cbc6bfaf02 Manager: also recognise exec.ErrNotFound as a "blender not found" error 2022-08-02 13:36:25 +02:00
Sybren A. Stüvel
11e5363d24 Manager: reject removal of empty list of blocklist entries
A request to remove an empty list of blocklist entries now results in a
400 Bad Request.
2022-08-01 18:55:33 +02:00
Sybren A. Stüvel
3b978ceda0 Cleanup: manager, name variable correctly
It was an old name from copy-pasted code, now it reflects the actual code.

No functional changes.
2022-08-01 18:55:08 +02:00
Sybren A. Stüvel
1469345f3a Manager: sort blocklist by worker name 2022-08-01 18:54:28 +02:00
Sybren A. Stüvel
f3aab8611c Manager: include worker name when returning blocklist 2022-08-01 18:03:17 +02:00