2247 Commits

Author SHA1 Message Date
Sybren A. Stüvel
a666b87f7f Manager: warn when the blender variable has no value
When the `blender` variable has no value, Flamenco will not be able to
run Blender, which is worth emitting a warning about early on.

This required a bit of a reshuffle of the configuration loading logic, to
avoid loading things twice (and thus warning twice).

Fixes part of #104366
2025-03-20 13:09:42 +01:00
Sybren A. Stüvel
0766074120 Website: set 3.7-alpha1 as last experimental version 2025-02-28 12:34:52 +01:00
Sybren A. Stüvel
b80bad12cd Bump version to 3.7-beta1 2025-02-28 12:32:40 +01:00
Sybren A. Stüvel
d10bb0a9d7 Manager: at startup check for stuck pause-requested jobs
When the Manager starts up, it now also checks whether `pause-requested`
jobs can actually go to `paused`.
2025-02-28 12:32:36 +01:00
Sybren A. Stüvel
ff29d2ef26 Manager: fix jobs getting stuck in pause-requested status
When a Worker would sign off while working on a task, and that task's
job would be in `pause-requested` state, it would always re-queue the
task. This in turn would not get detected, which caused the job to get
stuck.

Now tasks correctly go to `paused` when a Worker signs off, and
subsequently the job will be re-checked and go to `paused` when possible
as well.

Note that this does not handle already-stuck jobs. That'll be for the
following commit.
2025-02-28 12:26:01 +01:00
Sybren A. Stüvel
efdc5a5a20 Website: mark the 'single image' job type as for v3.6+
Now that v3.6 has been released, the overly-specific "v3.6-alpha+" can be
replaced with simply "v3.6".
2025-02-21 11:06:42 +01:00
Nitin-Rawat-1
e558883c7f Fix #104352: Nil reference panic when FFmpeg can be found (#104353)
Fix a `nil` dereference caused by an extra check on `err`.

Co-authored-by: Nitin Rawat <shvmnrwt@gmail.com>
Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104353
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
2025-02-17 15:38:08 +01:00
Sybren A. Stüvel
eb7177388c Update CHANGELOG.md 2025-02-14 18:52:47 +01:00
Sybren A. Stüvel
3fb73c6c9a Make two-way variable replacement case-insensitive
The conversion from a known path prefix to a variable is now done in a
case-insensitive way. This means that if the variable `{storage}` has
value `S:\Flamenco`, a path `s:\flamenco\project\file.blend` will be
recognised and replaced with `{storage}\project\file.blend`.

This happens uniformly, regardless of the platform. So also on Linux,
which has a case-sensitive filesystem, this matching is done in a
case-insensitive way. It is very unlikely that a Flamenco configuration
has two separate variables, for paths that only differ in their case.

Fixes: #104336 Drive letter case mismatch causes two way variables not
to work correctly
2025-02-14 18:44:52 +01:00
Sybren A. Stüvel
fb65e55c98 Worker: improve warning when FFmpeg cannot be found
On Linux (at least my Ubuntu) the error from finding FFmpeg wasn't
identified as a "file not found" error, and thus the more abstract
"unexpected error" message was logged.

Now any error with "file not found" in the message is handled as such,
and just produces a warning without the word "error" in there.
2025-02-10 12:28:37 +01:00
Sybren A. Stüvel
e48fa4cc5f Manager: load job compiler scripts on demand, instead of at startup
The Manager now loads the JavaScript files for job types on demand,
instead of caching them in memory at startup.

This will make certain calls a bit less performant, but in practice this
is around the order of a millisecond so it shouldn't matter much.

Fixes: #104349
2025-02-10 12:07:55 +01:00
Sybren A. Stüvel
e3d5d6b041 Manager: avoid double-logging errors in job compiler scripts
Return a custom error type from `VM.getCompileJob()`, so that underlying
errors can be wrapped and more info can be given to the caller. This
replaces a local logger call, preventing both the function and its
caller logging the same error.
2025-02-10 12:07:47 +01:00
Sybren A. Stüvel
10b91422cc Website: upgrade NodeJS dependency from v18 to v22
The latest NodeJS LTS release (v22) seems to work fine. No need to stick
to older versions, from what I can see.
2025-02-10 12:07:47 +01:00
Sybren A. Stüvel
b845189dfc Manager: protect task state machine with a mutex
Protect the public functions of the task state machine with a mutex, so
that only one task/job state change is handled at a time.

This should avoid race conditions.
2025-01-09 15:28:06 +01:00
Sybren A. Stüvel
1c50837577 Makefile: remove unused phony targets 2025-01-09 14:46:43 +01:00
Sybren A. Stüvel
8b322e84f8 Manager: prevent error when fetching task that was never assigned
Prevent an error when fetching a task that was never assigned to a
worker.

The error:

```
WRN error fetching task worker
    error="fetching worker : worker not found: sql: no rows in result set"
```
2025-01-09 14:45:30 +01:00
Sybren A. Stüvel
234cfbf983 Manager: add mage target for building with the race condition checker
Run `mage FlamencoManagerRace` to build Flamenco Manager with the
race condition checker enabled.

See https://go.dev/doc/articles/race_detector
2025-01-09 14:39:21 +01:00
Sybren A. Stüvel
35d6b03a3b Manager: log warning when built with race condition checker enabled 2025-01-09 14:38:47 +01:00
Sybren A. Stüvel
94687f78e9 Website: prevent newline after shortcodes 2025-01-09 11:12:55 +01:00
Sybren A. Stüvel
e4692e77e8 Website: Add more links to the built-in job compiler scripts
I hope this makes them easier to find.
2025-01-09 11:00:17 +01:00
Sybren A. Stüvel
7be05afa11 Cleanup: remove unused code 2024-12-04 14:05:50 +01:00
Sybren A. Stüvel
531a0184f7 Transition from ex-GORM structs to sqlc structs (5/5)
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated
structs. This also makes it possible to use more specific structs that
are more taylored to the specific queries, increasing efficiency.

This commit deals with the remaining areas, like the job deleter, task
timeout checker, and task state machine. And anything else to get things
running again.

Functional changes are kept to a minimum, as the API still serves the
same data.

Because this work covers so much of Flamenco's code, it's been split up
into different commits. Each commit brings Flamenco to a state where it
compiles and unit tests pass. Only the result of the final commit has
actually been tested properly.

Ref: #104343
2024-12-04 14:00:22 +01:00
Sybren A. Stüvel
ddced5a823 Transition from ex-GORM structs to sqlc structs (4/5)
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated
structs. This also makes it possible to use more specific structs that
are more taylored to the specific queries, increasing efficiency.

This commit deals with the worker sleep schedule.

Functional changes are kept to a minimum, as the API still serves the
same data.

Because this work covers so much of Flamenco's code, it's been split up
into different commits. Each commit brings Flamenco to a state where it
compiles and unit tests pass. Only the result of the final commit has
actually been tested properly.

Ref: #104343
2024-12-04 14:00:19 +01:00
Sybren A. Stüvel
c04e4992e0 Transition from ex-GORM structs to sqlc structs (3/5)
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated
structs. This also makes it possible to use more specific structs that
are more taylored to the specific queries, increasing efficiency.

This commit deals with worker tags (on both workers and jobs).

Functional changes are kept to a minimum, as the API still serves the
same data.

Because this work covers so much of Flamenco's code, it's been split up
into different commits. Each commit brings Flamenco to a state where it
compiles and unit tests pass. Only the result of the final commit has
actually been tested properly.

Ref: #104343
2024-12-04 14:00:16 +01:00
Sybren A. Stüvel
84f93e7502 Transition from ex-GORM structs to sqlc structs (2/5)
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated
structs. This also makes it possible to use more specific structs that
are more taylored to the specific queries, increasing efficiency.

This commit mostly deals with workers, including the sleep schedule and
task scheduler.

Functional changes are kept to a minimum, as the API still serves the
same data.

Because this work covers so much of Flamenco's code, it's been split up
into different commits. Each commit brings Flamenco to a state where it
compiles and unit tests pass. Only the result of the final commit has
actually been tested properly.

Ref: #104343
2024-12-04 14:00:13 +01:00
Sybren A. Stüvel
94d71bc3c9 Transition from ex-GORM structs to sqlc structs (1/5)
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated
structs. This also makes it possible to use more specific structs that
are more taylored to the specific queries, increasing efficiency.

This commit covers job blocklists and last-rendered images.

Functional changes are kept to a minimum, as the API still serves the
same data.

Because this work covers so much of Flamenco's code, it's been split up
into different commits. Each commit brings Flamenco to a state where it
compiles and unit tests pass. Only the result of the final commit has
actually been tested properly.

Ref: #104343
2024-12-04 14:00:07 +01:00
Sybren A. Stüvel
977247a117 Delete cmd/job-creator and cmd/shaman-checkout-id-setter
These two tools were necessary to work around certain limitations of
earlier versions of Flamenco, and are no longer needed. And they're getting
in the way of other development.
2024-12-04 13:30:10 +01:00
Sybren A. Stüvel
406e1ee655 Mark 3.7 as in development 2024-12-01 15:07:19 +01:00
Sybren A. Stüvel
44be746ab6 Bumped version to 3.7-alpha1 2024-12-01 15:06:51 +01:00
Sybren A. Stüvel
d596abf853 Mark 3.6 as released today 2024-12-01 15:00:18 +01:00
Sybren A. Stüvel
78d59838ba Website: version 3.6 on downloads page 2024-12-01 14:57:49 +01:00
Sybren A. Stüvel
940f814fcc Bumped version to 3.6 2024-12-01 14:54:15 +01:00
Sybren A. Stüvel
a9bec98fcd Fix linter warnings
Fix most linter warnings reported by 'staticcheck'. This doesn't fix all
of them, some unused functions are still there, and some generated code
also still triggers some warnings. Most issues are fixed, though.

No functional changes, except for the captialisation of some error
messages.
2024-12-01 14:49:25 +01:00
Sybren A. Stüvel
167dd027c1 Move the 'Single Image Render' job type to the website
Move the 'Single Image Render' job type to the 'third party job types'
section on the website. It needs more testing & finessing before it can be
bundled with Flamenco.
2024-12-01 14:08:18 +01:00
Sybren A. Stüvel
dfed899c08 Refactor: ensure test function params are in (expected, actual) order
No functional changes
2024-11-11 19:20:41 +01:00
Sybren A. Stüvel
def44abb64 Mage: forward LDFLAGS environment variable to Go build command
When building Flamenco Manager/Worker, forward the `LDFLAGS` environment
variable value to the build command. This makes it possible to override
certain variables, like the default configuration file location.
2024-11-11 11:55:46 +01:00
Sybren A. Stüvel
ed014ccc2a Worker: log which config paths are used at startup
To aid in debugging configuration loading issues, log the paths to config
files at startup.
2024-11-11 11:49:36 +01:00
Sybren A. Stüvel
b84523c0ae Fix build issue with vendored sources
Fix a build issue when `go mod vendor` was used to vendor all the sources.
This now includes Mage (`github.com/magefile/mage/mage`), so that the
build tool itself can be built too.
2024-11-11 11:00:59 +01:00
Sybren A. Stüvel
30997013b1 Fix: Blender add-on was accidentally built as flamenco3-addon.zip
The Mage-based build tools accidentally built the add-on as
`flamenco3-addon.zip` instead of `flamenco-addon.zip`.
2024-11-11 10:55:48 +01:00
Sybren A. Stüvel
7f37c16a8d Add 'index in job' number to tasks
Number the tasks in a job, indicating their creation order. This gives the
web interface something to sort on that doesn't change on task updates.
2024-11-09 23:07:23 +01:00
Sybren A. Stüvel
b3385394ae OAPI: regenerate code 2024-11-09 23:01:52 +01:00
Sybren A. Stüvel
6efd5144da OAPI: Add 'index in job' field to tasks
Give tasks a new field, explicitly storing the creation order of the tasks
in the job. This makes it possible for the web interface to show the tasks
in a stable order, without jumping around when they update.
2024-11-09 22:59:51 +01:00
Sybren A. Stüvel
e08bdbdf16 Manager: increase database busy timeout from 5 to 20 seconds
When under heavy load, queries can take longer.
2024-10-10 15:08:48 +02:00
Sybren A. Stüvel
479f35b658 Mage: avoid creating web/static/emptyfile with wrong permissions
The empty file is created so that Go has something to embed when building
Flamenco  Manager, even when the static files aren't built yet. On macOS
this was done with the wrong permissions, though.
2024-10-05 10:25:02 +02:00
Sybren A. Stüvel
7d8262e630 Website: document the use of build tool mage 2024-10-04 22:47:29 +02:00
Sybren A. Stüvel
4ae4b892fd Mage: remove duplicated targets
The same functionality was available as two Mage targets.

WebappInstallDeps has been removed, in favour of InstallDepsWebapp.
2024-10-04 22:46:46 +02:00
Sybren A. Stüvel
5f37bcb629 Build with Magefile (#104341)
Convert most of the code in `Makefile` to [Magefile](https://magefile.org/):

This makes it possible to build Flamenco without `make` (and the POSIX environment/commands it expect) by running:

```bash
$ go run mage.go webappInstallDeps  # Only on the first build.
$ go run mage.go build
```

More efficient builds are possible with other commands, and some release-related commands still require `make`. At least the barrier to entry should be considerably lower (compared to having to install Make + Cygwin/MSYS2 on Windows).

Fix: #102633

This does not port the building of release packages, so it doesn't address #102671.

### Main Targets

| Target   | Description                                                                     |
|----------|---------------------------------------------------------------------------------|
| build    | Build Flamenco Manager and Flamenco Worker, including the webapp and the add-on |
| check    | Run unit tests, check for vulnerabilities, and run the linter                   |
| clean    | Remove executables and other build output                                       |
| generate | Generate code (OpenAPI and test mocks)                                          |

### All Targets

Get these via `go run mage.go -l`:

```
Targets:
  build                           Flamenco Manager and Flamenco Worker, including the webapp and the add-on
  check                           Run unit tests, check for vulnerabilities, and run the linter
  clean                           Remove executables and other build output
  flamencoManager                 Build Flamenco Manager with the webapp and add-on ZIP embedded
  flamencoManagerWithoutWebapp    Only build the Flamenco Manager executable, do not rebuild the webapp
  flamencoWorker                  Build the Flamenco Worker executable
  generate                        code (OpenAPI and test mocks)
  generateGo                      Generate Go code for Flamenco Manager and Worker
  generateJS                      Generate JavaScript code for the webapp
  generatePy                      Generate Python code for the add-on
  govulncheck                     Check for known vulnerabilities.
  staticcheck                     Analyse the source code.
  test                            Run unit tests
  version                         Show which version information would be embedded in executables
  vet                             Run `go vet`
  webappInstallDeps               Use Yarn to install the webapp's NodeJS dependencies
  webappStatic                    Build the webapp as static files that can be served
```

Co-authored-by: Mateus Abelli <mateusabelli@gmail.com>
Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104341
2024-10-04 21:59:44 +02:00
Sybren A. Stüvel
d61f6c9e14 Manager: in setup assistant, find Blender in macOS default install dir
On macOS, automatically find Blender when it is installed in the default
installation directory (`/Applications/Blender.app`)
2024-10-03 21:15:56 +02:00
Sybren A. Stüvel
cbf82e4a55 OAPI: regenerate code 2024-10-03 21:15:56 +02:00
Sybren A. Stüvel
8c4ac87ad9 OAPI: add 'system_location' as possible source of Blender locations
When finding Blender, Flamenco should be able to find it in platform-
specific default locations. This is mostly used for macOS, where Blender
is typically installed in `/Applications/Blender.app`.
2024-10-03 21:15:56 +02:00