Commit Graph

1855 Commits

Author SHA1 Message Date
3a3e664ae2 Add option to make a job setting auto-evaluatable by the user
Add a new job setting option `autoevalLockable`. Setting this to `true` in
the job compiler's `JOB_TYPE` settings has the following effect:

- By default, the setting will not be editable in Blender's job submission
  interface. Instead, a toggle button with a 'car' icon will be shown.
- When the 'car' button is toggled off, the setting becomes editable again.

In its default, uneditable state, the setting will be auto-evaluated before
submission.

This makes it possible to 'lock in' auto-evaluation. The main use case is
for the frame range of the render job. By default this will be locked to
the scene frame range, but it can still be overridden if a different
range is wanted.
2023-07-13 12:07:02 +02:00
168305f785 OAPI: regenerate code 2023-07-13 12:06:21 +02:00
553fffa21e OAPI: add option to make a job setting auto-evaluatable by the user
Add a new job setting option `autoevalLockable`. Setting this to `true` in
the job compiler's `JOB_TYPE` settings has the following effect:

- By default, the setting will not be editable in Blender's job submission
  interface. Instead, a toggle button with a 'car' icon will be shown.
- When the 'car' button is toggled off, the setting becomes editable again.

In its default, uneditable state, the setting will be auto-evaluated before
submission.

This makes it possible to 'lock in' auto-evaluation. The main use case is
for the frame range of the render job. By default this will be locked to
the scene frame range, but it can still be overridden if a different
range is wanted.

This commit just contains the necessary OpenAPI change.
2023-07-13 12:00:29 +02:00
498a71f00c .gitattributes: explicitly denote specific file extensions as 'text'
Configure auto-clrf for all text files. This should make it simpler to
develop Flamenco on Windows, as it makes Git depend less on its global
settings.
2023-07-13 11:55:41 +02:00
a5e405de16 Web: more SocketIO documentation
Add that the OpenAPI specs also define the structures used for SocketIO
communication.
2023-07-13 10:13:24 +02:00
b83b929e01 Web: add some technical details to the socketIO documentation
Add technical details to explain which part of the SocketIO-based broadcast
system is implemented where in the source code.
2023-07-13 10:08:34 +02:00
Michael Cook
520102627d Worker: Point users to docs if worker cannot find Blender
When the Worker cannot find Blender when it starts, provide a more
helpful message + a link to the relevant documentation.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104230
2023-07-10 15:09:06 +02:00
effac1c159 Git-ignore .vscode/launch.json 2023-07-10 14:10:49 +02:00
b58f1e15f1 Add CLI utility to recreate tasks of jobs
Due to an issue (which has been fixed in the previous commit), all tasks
in the database were deleted when starting Flamenco. This tool attempts
to recompile the job and recreate its tasks.

The statuses of the tasks are set based on the job status. Basically:

- job active → tasks queued
- job completed → tasks completed
- job cancelled / failed → tasks cancelled
- otherwise → tasks queued

To ensure that the tool is only used to create tasks from scratch, it
refuses to work on a job that still has tasks in the database.
2023-07-10 14:10:15 +02:00
06738b8aa4 Manager: disable SQLite foreign key constraints when migrating the database
There is an issue with the GORM auto-migration, in that it doesn't
always disable foreign key constraints when it should. Due to
limitations of SQLite, not all 'alter table' commands you'd want to use
are available. As a workaround, these steps are performed:

1. create a new table with the desired schema,
2. copy the data over,
3. drop the old table,
4. rename the new table to the old name.

Step #3 will wreak havoc with the database when foreign key constraint
checks are active, so no we temporarily deactivate them while performing
database migration.
2023-07-10 14:06:21 +02:00
60d54eabb3 Manager: avoid recreation of Worker table at startup
Mark the default value of `Worker.LazyStatusRequest` as `false`. The
previous default was configured as `0`, which was different enough to
always trigger a database migration of that column. However, since these
values do map to each other, the migration didn't do anything concrete,
and would be triggered again at the next startup.
2023-07-10 13:56:47 +02:00
6a170a3ae4 Deployment: make backup of SQLite database before every deploy
Every time Flamenco Manager is shut down in order to upgrade, a database
copy is made.
2023-07-10 12:42:15 +02:00
Eveline Anderson
830c3fe794 Rename worker 'clusters' to 'tags'
As it was decided that the name "tags" would be better for the clarity
of the feature, all files and code named "cluster" or "worker cluster"
have been removed and replaced with "tag" and "worker tag". This is only
a name change, no other features were touched.

This addresses part of #104204.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104223

As a note to anyone who already ran a pre-release version of Flamenco
and configured some worker clusters, with the help of an SQLite client
you can migrate the clusters to tags. First build Flamenco Manager and
start it, to create the new database schema. Then run these SQL queries
via an sqlite commandline client:

```sql
insert into worker_tags
    (id, created_at, updated_at, uuid, name, description)
  select id, created_at, updated_at, uuid, name, description
  from worker_clusters;

insert into worker_tag_membership (worker_tag_id, worker_id)
  select worker_cluster_id, worker_id from worker_cluster_membership;
```
2023-07-10 11:11:03 +02:00
Eveline Anderson
341dc6c8e2 OAPI: regenerate code 2023-07-10 11:08:44 +02:00
Eveline Anderson
df51561640 OAPI: rename worker 'cluster' to 'tag'
This implements the OpenAPI changes necessary for the rename.

See #104204

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104223
2023-07-10 11:08:39 +02:00
44ec93275d Cleanup: reformat all Go files
Run `go fmt` on all files, to fix their formatting.

No functional changes.
2023-07-10 10:58:14 +02:00
Michael Cook
b20ede97ea Shaman: fail unit test when running as root user
If the mock tests are run by root user then this specific test of
inaccessible path fails because root can write files to anywhere on the
filesystem. It is not clear that Flamenco Manager test
TestCheckSharedStoragePath is checking inaccessible file locations when
it fails and that it should be run by an unprivileged user.

Fix is to fail the permission test if the tests are run as a root user.
2023-07-07 16:05:43 +02:00
7a508c7e6b Manager: perform database integrity check at startup
Perform these two SQL calls & check their result:

- `PRAGMA integrity_check`
- `PRAGMA foreign_key_check`:

See  https: //www.sqlite.org/pragma.html for more info on these.

This also removes the unused `PeriodicMaintenanceLoop()` function.
Periodic checking while Flamenco Manager is running might be introduced
in a future commit, after the startup-time checks have been shown to not
get in the way.
2023-07-07 16:03:06 +02:00
7f588e6dbc Manager: close database connection on startup errors
When there is an error detected at startup, close the database connection.
Before, the connection could be kept open even when an error was returned,
causing the write-ahead log files to be kept around. These are now
properly integrated into the main database file before exiting.
2023-07-07 15:48:08 +02:00
2bc6c77e49 Deploy: move old worker executable before overwriting
Move the old worker out of the way. This should keep the old executable
as-is on disk, hopefully keeping currently-running processes happy.

I've noticed some workers crashing as soon as the executable got
replaced, which made me suspect that it's not 100% loaded to memory
before starting the execution. Let's see if this works better.
2023-07-07 14:09:38 +02:00
988cdf61ff Upgrade GORM & SQLite
Upgrade:
- `gorm.io/gorm` v1.23.8 → 1.25.2
- `github.com/glebarez/go-sqlite` v1.17.3 → v1.8.0
- `github.com/glebarez/sqlite` v1.4.6 → v1.8.0

and also some indirect dependencies.

This is in the hope that some weird cases at Blender Studio get resolved.
It appears that sometimes, for some unknown reason, when deleting a job,
its tasks get reassigned to another job (instead of also getting deleted).

Since there is no code in Flamenco itself to do this task deletion (it's
all depending on SQLite following the foreign keys and cascading to tasks),
I hope it was a bug in either GORM or SQLite that got fixed at some point.
2023-07-06 16:08:57 +02:00
22f4aa09f3 Manager: expand job deletion unit test
Add extra job to the database before deleting one, to ensure that job
deletion doesn't do anything with other jobs (and their tasks).

No functional changes to Flamenco itself.
2023-07-06 16:08:57 +02:00
Michael Cook
5657f5e1fe Manager: Fix logURLs possble typo
Change "possble URL" to "possible URLs".

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104231
2023-07-06 12:43:40 +02:00
6a30f844eb Manager: Better reporting of version via API call
Before: `3.3-alpha0-v3.2-76-gdd34d538-dirty`
After : `3.3-alpha0 (v3.2-76-gdd34d538-dirty)`

Also include the new `git` property to always have the Git hash (the part
between parentheses).
2023-07-06 12:21:47 +02:00
82456424c9 OAPI: regenerate code 2023-07-06 12:19:48 +02:00
c6dcf6d7bd OAPI: better reporting of version info
Make it explicit that the `version` property is for human consumption.
Also add a new `git` property so that all info from `version` is also
included in separate fields for machine consumption.
2023-07-06 12:18:26 +02:00
Michael Cook
dd34d538ec fix links in mgr configuration doc section (#104226)
Actually include the link URLs in the documentation.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104226
2023-07-03 11:11:44 +02:00
77db55bb14 Manager: when worker signs off, only remember specific statuses
Limit which worker statuses are remembered (when they go offline) to
those that we want to restore when they come back online. This is now
set to `awake` and `asleep`. This prevents workers from being told to go
to states that they cannot handle, such as `error` or `starting`.
2023-06-23 11:38:37 +02:00
Adi Sage
8a5c099d57 Website: Documenting descriptions for Job and Task Statuses in the documentation webpage
This is a comprehensive list of all possible job and task statuses,
along with a brief description of each status
and a list of possible next statuses.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104214
2023-06-22 19:41:51 +02:00
Bastien Montagne
71f2947c4b Add 'copy-file' command. (#104220)
Initial implementation with some basic tests.

The API command only accept one source and destination path, which must
be absolute. If the destination already exists, it will not be
ovewritten, and an error is generated.

JS job definition code using this new command can easily handle list of
paths and/or relative paths if needed.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104220
2023-06-08 16:20:43 +02:00
5b60a0f550 Update CHANGELOG.md 2023-06-02 22:58:54 +02:00
49aeccf37b Remove vscode settings
This prevents different user preferences fighting each other.

Other VSCode files are still there as I think they're generally useful:
- `extensions.json` for suggesting some VSCode extensions
- `launch.json` to launch Worker and Manager in the debugger
2023-06-02 22:56:20 +02:00
Eveline Anderson
4d2200bb0c Fix #99549: Remember Previous Status (#104217)
Fix #99549: When sending Workers offline, remember their previous status

When the status of a worker goes offline, the Manager will now make the status of the worker to be remembered once it goes back online. So when the Worker makes this status change (so for example `X → offline`), Manager should immediately set `StatusRequested = "X" ` once it goes online.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104217
2023-06-02 22:50:07 +02:00
2c163652c0 Makefile: when deploying the website, avoid setting timestamps & owners
The current setup on our webserver disallows setting timestamps or
permissions on the root (of the website) directory, so `rsync -a`
caused an error.

`-a` is a synonym of `-rlptgoD`; the new options are that minus `-t` for
setting times, `-o` and `-g` for setting file ownership (they should
be owned by the uploading user), and `-p` for setting permissions.
2023-06-02 10:51:49 +02:00
86514b9342 Remove the 'None' project finder, set 'blender project' as default
The 'None' project finder is the old behaviour of the add-on, and it is not
really necessary. If any of the other finders cannot find the directory
they're looking for, they'll return the current blend file's directory
anyway.

The new default is 'blender project'.
2023-06-01 16:34:13 +02:00
f4f61ea593 Add 'project finders' to the add-on
The Flamenco add-on can now find the top-level directory of your Blender
project. It can be configured to find any of these directories:

- `.blender_project`
- `.git`
- `.subversion`
- None, which is the default and the old behaviour of just using the
  directory of the current blend file as the 'project directory'.
2023-06-01 16:07:11 +02:00
fbc7c0cfd9 Fix mypy errors
Mypy doesn't understand Blender property annotations.
2023-06-01 15:51:44 +02:00
87ff1187ef Fix #104218: Shaman unit test TestGarbageCollect is unstable
Copy files instead of hard-linking. The hard-links seemed to have some
weird behaviour, at least on Windows 10 where I tested this.
2023-05-31 13:57:48 +02:00
c1fe3fb740 Shaman GC: better logging for file deletion errors
When the Shaman GC process cannot remove files, log a message that explains
that this happens (and why).
2023-05-31 13:55:04 +02:00
caa2f9ccf1 Shaman: improve logging & checking of timestamps
Add more logging of timestamps in the actual code, and a few sanity
checks in unit tests.

These were useful while trying to find the root cause of #104218 and might
be useful in the future too. The solution to that issue will be committed
later.
2023-05-31 13:54:28 +02:00
16da14479b OAPI: regenerate code 2023-05-26 11:25:51 +02:00
Adi Sage
b56a610f8d OAPI: Remove obsolete job statuses
Remove the following statuses from `flamenco-openapi.yaml`:

- 'construction-failed'
- 'archiving'
- 'archived'

These were a leftover from Flamenco v2 and have never been used in
Flamenco v3.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104215
2023-05-26 11:25:35 +02:00
0086abcc7a Makefile: be less verbose when publishing the website 2023-05-26 11:20:05 +02:00
afde952c10 Fix incompatibility with 32-bit platforms 2023-05-24 21:23:05 +02:00
Adi Sage
0a2d7d3361 Website: Fix a typo in the docs for Job Types
In the first line of description for Job Types the word 'or' is changed to 'for'.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104212
2023-05-23 11:44:38 +02:00
9cbdadcd4b Add 'Flamenco gets stuck after the first chunk' to the FAQ
So far it's always been an add-on that caused this.
2023-05-22 16:21:42 +02:00
77ff6151bd Fix check-environment Makefile rule
Bunch of improvements to the `check-environment` rule:

- it was listed as the first target in `Makefile`, causing it to be run
  when you just use `make`. It's now moved down to where it is first used.
- Call with `$(MAKE) -s` so that there is less logging noise.
- Use `@echo` so that there is less logging noise.
- Change the example to set the right environment variable (it had a
  trailing underscore).
2023-05-19 12:09:29 +02:00
Francesco Siddi
9915951007 Deploy: Update deployment instructions
Move sensitive information into a dedicated .env file, which is
required only for deployment purposes.
2023-05-15 20:09:03 +02:00
ebf4021da2 Fix #104191: Manager build error on ARM64
Reimplement the `touch()` function on Linux to avoid depending on the
`syscall` package, and use the `sys/unix` package instead. This is
slightly higher level, and seems to build on AMD64 and ARM64.
2023-05-15 10:51:01 +02:00
bbeefd4bfa Website: fix developer 'get started' links
Links of the `[text][linkname]` form should not have a space between
the two bracketed parts. And I removed the link to projects.blender.org
because the other two links also link there (indirectly resp. directly).
2023-05-09 15:36:23 +02:00