664 Commits

Author SHA1 Message Date
Sybren A. Stüvel
28cc7b7a3f Manager: improve logging when workers register
The info message that a worker registered now also includes its UUID.
Any failure hashing the password will now also log the worker name + UUID.
2023-04-04 12:13:21 +02:00
Sybren A. Stüvel
e2559b1181 Cleanup: remove doubly-declared default value in persistence layer
No functional changes.
2023-04-03 16:59:22 +02:00
Sybren A. Stüvel
159ce5b34a Manager: avoid starting error messages with 'error'
No real functional changes, just server-side logging.
2023-04-03 16:58:48 +02:00
Sybren A. Stüvel
0ac64719e7 Job deleter: improve logging
Various improvements to the logging of the job deletion:

- Reduce the log level of the "removing logs" and "removing job from
  database" lines from INFO to DEBUG, so that only one line of INFO is
  logged per deleted job
- Show size of the queue and the check interval in the "job deletion
  queue is full" log message.
2023-03-21 12:16:04 +01:00
Sybren A. Stüvel
0fb252083b Job deletion: when stopping to queue up more deletions, log how many remain
When queueing up jobs to be deleted, log how many deletions remain to be
picked up later. Once a minute the database is checked for such deletion
requests, so the next batch will be scheduled in a minute.
2023-03-21 10:45:34 +01:00
Sybren A. Stüvel
b25e63f557 Job deletion: avoid looping over entire list of jobs when queue full
When there are more job deletion requests than can be kept in the queue,
just stop trying to queue them.
2023-03-21 10:44:28 +01:00
MKRelax
7963ab5efd Manager: fixed copy/paste typo in CheckBlenderExePath() (#104192)
The `toCheck` variable in `CheckBlenderExePath()` was initialized to `CheckSharedStoragePathJSONBody`, should be `CheckBlenderExePathJSONBody`.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104192
2023-03-06 12:55:53 +01:00
Sybren A. Stüvel
22f56890c1 Small fix for sleep schedule of soft-deleted workers
There were `ErrWorkerNotFound` errors in different packages, which got
mixed up. Now there's only one.
2023-02-09 11:46:29 +01:00
Sybren A. Stüvel
426b2aab4d Gracefully handle sleep schedules of deleted workers
Workers can be soft-deleted, which means that they stay in the database.
As such, foreign key constraints `ON DELETE CASCADE` do not trigger, and
thus their sleep schedule can still be active. This is now detected and
handled gracefully.
2023-02-09 11:18:38 +01:00
Sybren A. Stüvel
fe0899fd55 shaman-checkout-id-setter: Don't update job's "updated at" timestamp
The Shaman Checkout ID setter shouldn't update a job's "updated at"
timestamp. Its goal is to fake that the job was submitted with a new
enough Flamenco version, and thus should not touch the timestamps.
2023-02-07 16:24:23 +01:00
Sybren A. Stüvel
bf464055e0 Avoid double logging of job storage directory removal 2023-02-07 15:22:52 +01:00
Sybren A. Stüvel
01a85d86cb Add "Shaman Checkout ID setter" command
This is a command that can be run to retroactively set the Shaman
Checkout ID of jobs, allowing the job deletion to also remove the job's
Shaman checkout directory.

This is highly experimental, and not built by default or shipped with
Flamenco releases. It's only been used once at Blender Animation Studio
to help cleaning up. Run at your own risk. Make backups first.
2023-02-07 15:07:41 +01:00
Sybren A. Stüvel
aa1c6b8ff3 Close the database when Flamenco shuts down
This prevents SQLite journal files from lingering around.
2023-02-07 15:05:49 +01:00
Sybren A. Stüvel
ef3cab9745 Webapp: handle job deletions properly
- Add a little confirmation overlay before deleting a job. This overlay
  also shows information about whether the Shaman checkout directory
  will be deleted or not.
- Send job updates to the web frontend when jobs are marked for
  deletion, and when they are actually deleted.
- Respond to those updates, and handle some corner cases where job info
  is missing (because it just got deleted).

This closes T99401.
2023-02-03 16:59:15 +01:00
Sybren A. Stüvel
c21cc7d316 OAPI: regenerate code 2023-02-03 16:44:55 +01:00
Sybren A. Stüvel
bf0906eb95 Manager: avoid logging an error when requesting a non-existent job
This is expected to happen every once in a while, especially now that
Flamenco supports job deletion. It's not something to log at error level.
2023-02-03 16:37:55 +01:00
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