125 Commits

Author SHA1 Message Date
Sybren A. Stüvel
22ea599554 Manager: periodically run the SQL VACUUM command 2022-03-17 11:03:29 +01:00
Sybren A. Stüvel
93616cef3a Manager: reduce log level of "worker requesting task" 2022-03-17 10:53:00 +01:00
Sybren A. Stüvel
9066fcacff Manager: reorder Simple Blender Render settings 2022-03-15 17:49:20 +01:00
Sybren A. Stüvel
2187464d5e Allow the render output path to have a {timestamp} field 2022-03-15 17:18:11 +01:00
Sybren A. Stüvel
09a476e11a Compute render output path when evaluating job settings
Compute render output path when evaluating job settings, which is done
within the Flamenco add-on, instead of in the job compiler script. This
allows the UI to show the render path, rather than it only being known
after the job has been submitted.
2022-03-15 16:56:44 +01:00
Sybren A. Stüvel
7bfde1df0b Manager: determine final render output path in job compiler
This might not be the best way to do things, but it is very flexible and
allows TDs to determine the behaviour in their own job compiler script.
It doesn't allow a preview of "this is what the final render path will be"
in the Blender GUI though.
2022-03-15 13:17:55 +01:00
Sybren A. Stüvel
2cf388566f Cleanup: manager, remove unused code 2022-03-15 13:16:21 +01:00
Sybren A. Stüvel
6d492a48b4 Manager: tooltip for frame range setting 2022-03-15 11:32:59 +01:00
Sybren A. Stüvel
4ca71d96ce Manager: fix pythonisms in JS code 2022-03-15 11:32:23 +01:00
Sybren A. Stüvel
e15f066dde Automatically evaluate hidden job settings
Job settings that are not visible and have an `eval` key will be
automatically evaluated when the job is submitted.
2022-03-15 10:56:58 +01:00
Sybren A. Stüvel
4e570d601c Manager: fix tests for recent change from filepath to blendfile setting
4196460c29a607e1d3d2d052bf2bf546d5c05616 changed the name of the job
setting used to communicate the input blend file path, but the tests
weren't updated for this.
2022-03-15 10:46:58 +01:00
Sybren A. Stüvel
a6ac331612 Allow Python evaluation for computing job settings in the addon 2022-03-14 18:44:39 +01:00
Sybren A. Stüvel
4196460c29 Automatically include input blend file path in job settings 2022-03-14 18:18:10 +01:00
Sybren A. Stüvel
7b090bdbd6 OAPI: job submission endpoint now returns Job instead of SubmittedJob 2022-03-14 16:59:59 +01:00
Sybren A. Stüvel
2e78e00a0b Manager: don't log an error when the config file doesn't exist
The configuration file is expected to not exist on many systems, and
thus logging an error (even when it's a very innocent one) will cause
confusion.
2022-03-14 13:00:27 +01:00
Sybren A. Stüvel
7181c2c4cf OAPI: allow job settings to have a tooltip/description 2022-03-11 17:30:27 +01:00
Sybren A. Stüvel
6d00d9cb34 Manager: sort job types to ensure a consistent order 2022-03-11 17:30:27 +01:00
Sybren A. Stüvel
b33db33d17 Manager: show error when there was an error loading configuration 2022-03-11 10:51:32 +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
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
dbb9c71df8 Tests: more unified way to do database tests 2022-03-04 12:33:45 +01:00
Sybren A. Stüvel
f497ac8536 Cleanup: add and remove some comments 2022-03-04 12:19:19 +01:00
Sybren A. Stüvel
3bfd5a339f Fix database tests getting interrupted
The root cause was a 2nd `context.Context()` that was used in
`constructTestJob()`, which cancelled when that function returned.

The cancellation of the context caused an interrupt in the SQLite
driver, which got into a race condition and could cause an interrupt on
a subsequent database query.
2022-03-04 12:19:19 +01:00
Sybren A. Stüvel
de150567b0 Manager: avoid double error message 2022-03-04 11:37:29 +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
c91e7b1cac Manager: solve failing unittests by implementing some filepath functions
Both Go's standard `path` and `path/filepath` packages are too limiting to
work well for Flamenco. The former assumes Linux/POSIX paths, the latter
only works with platform-native paths. Neither can work with Windows paths
on Linux, or Linux paths on Windows.
2022-03-03 15:22:43 +01:00
Sybren A. Stüvel
b9609f8866 Cleanup: remove unused code 2022-03-03 13:52:57 +01:00
Sybren A. Stüvel
641ed7ace9 Manager: make Gorm use Zerolog for logging
A wrapper for Zerolog implements the Gorm logger interface. This gives
us coloured output on Windows, and uniform-looking logs in production.
2022-03-03 13:52:50 +01:00
Sybren A. Stüvel
8824489980 Manager: use in-memory SQLite database for testing
The on-disk database that was used before caused issues with tests running
in parallel. Not only is there the theoretical issue of tests seeing each
other's data (this didn't happen, but could), there was also the practical
issue of one test running while the other tried to erase the database file
(which fails on Windows due to file locking).
2022-03-03 13:51:55 +01:00
Sybren A. Stüvel
9b9c6bffff Replace self-hacked SQLite Gorm driver with 3rd party one
The new Gorm driver is made by the creators of the pure-Go SQLite library
we were already using.
2022-03-03 13:48:14 +01:00
Sybren A. Stüvel
2b04623e00 Manager: fix DB transaction isolation issue in task scheduler
The created transaction wasn't actually used for the should-be-in-the-
transaction queries. That's now resolved.
2022-03-03 13:46:27 +01:00
Sybren A. Stüvel
9643bf768e Manager: Fix DB migration error of not-null columns
Where the PostgreSQL DB migration code could handle `NOT NULL` columns just
fine, SQLite has less table-altering functionality. As a result, migrations
have to copy entire database tables, which doesn't play well with
not-nullable columns.
2022-03-03 12:10:13 +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
e70a44a146 Manager: switch from PostgreSQL to SQLite
This includes a modified copy of the Gorm SQLite backend, adjusted to use
https://modernc.org/sqlite instead.
2022-03-01 18:50:31 +01:00
Sybren A. Stüvel
bbc6a3f69e Tweak some logging 2022-03-01 17:28:24 +01:00
Sybren A. Stüvel
0235ffcb4a Manager: avoid "no record found" error in task scheduler
It's fine when there is no task for a worker, so having Gorm log an error
was just causing noise.
2022-03-01 11:52:28 +01:00
Sybren A. Stüvel
7e5a631f33 Cleanup: refactor updateJobAfterTaskStatusChange()
Break up a complex function into smaller functions.
2022-02-28 12:50:34 +01:00
Sybren A. Stüvel
fab988295d Manager: remove task scheduler SQL debug logs 2022-02-28 12:07:23 +01:00
Sybren A. Stüvel
7689a988b1 Manager: re-queue tasks of worker when signing off 2022-02-28 12:06:50 +01:00
Sybren A. Stüvel
32af1ffaef Manager: actually pass context to Gorm queries 2022-02-28 11:53:31 +01:00
Sybren A. Stüvel
3d854078ba Manager: integrate task state machine into API implementation 2022-02-25 16:30:27 +01:00
Sybren A. Stüvel
17e622ebc3 Some build & filename tweaks to allow building from scratch again
The build chain got a bit confused when doing things from scratch, as
`test_support.go` was used in the non-test builds. Renaming it to
`support_test.go` was the easiest way to avoid that.
2022-02-25 16:17:49 +01:00
Sybren A. Stüvel
9a5bbb4131 Manager: implement persistence layer interface for task status machine
Implement the functions used by the task status machine in the DB
persistence layer.
2022-02-25 14:34:29 +01:00
Sybren A. Stüvel
7279f2e35f Manager: task state machine, handle job status -> task status changes
Direct copy of the Flamenco Server Python code, for handling the change
of a job's status to trigger status changes on its tasks.

Not yet connected to the rest of the Manager logic.
2022-02-25 12:30:40 +01:00
Sybren A. Stüvel
e8707171b4 Manager: add test for saving task status change with error on job save 2022-02-25 11:07:06 +01:00
Sybren A. Stüvel
d2f1cf3614 Cleanup: move test helper functions down in the file
This way it starts with the actual tests.
2022-02-25 11:02:47 +01:00
Sybren A. Stüvel
a3a0d97222 Manager: more task state change tests 2022-02-24 17:58:02 +01:00
Sybren A. Stüvel
df77d09aa6 Start of a task/job state machine
The task status change → job status change code is a direct port of the
Flamenco Server v2 code written in Python.

There is no job status change → task status changes logic yet, and the
tests are also far from complete.
2022-02-24 16:42:38 +01:00
Sybren A. Stüvel
64db518f15 Cleanup: remove unused code 2022-02-24 12:36:29 +01:00
Sybren A. Stüvel
7420177209 Manager: use api.JobStatus in persistence layer as well 2022-02-24 11:54:35 +01:00