279 Commits

Author SHA1 Message Date
Sybren A. Stüvel
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
Sybren A. Stüvel
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
Sybren A. Stüvel
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
Sybren A. Stüvel
472b73eb5c Cleanup: run go fmt ./...
No functional changes.
2023-04-17 16:36:52 +02:00
Sybren A. Stüvel
f5ab2bb4c2 OAPI: regenerate code 2023-04-04 13:18:59 +02:00
Sybren A. Stüvel
0e6b6a6013 API: allow worker cluster creation without explicit UUID
Clusters can be created without UUID now. In that case, a random one will
be generated. The cluster will be returned by the creation call, so that
the caller can know that generated UUID.
2023-04-04 13:18:24 +02:00
Sybren A. Stüvel
675d966263 OAPI: regenerate code 2023-04-04 12:18:17 +02:00
Sybren A. Stüvel
cbbf7b01d6 API: add worker clusters to the API
Worker Clusters can be managed via the API, workers can be assigned to
any number of clusters (if not assigned to any, they'll pick up any task).

Jobs can be submitted with a cluster ID, in which case only workers that
are in that cluster or are clusterless will pick up its tasks.
2023-04-04 12:16:54 +02:00
Sybren A. Stüvel
c21cc7d316 OAPI: regenerate code 2023-02-03 16:44:55 +01:00
Sybren A. Stüvel
92ac1d99de OAPI: add job-deletion-related operation & schema extensions
Add a "what-would-delete-do" operation, to query the Manager about what
the deletion of a specific job would entail. For some jobs the job files
will also be deleted (if they were created with a new enough Flamenco),
otherwise they will remain untouched.

Also expand the `SocketIOJobUpdate` schema to include info about job
deletion.
2023-02-03 16:41:50 +01:00
Sybren A. Stüvel
067f2a439e OAPI: regenerate code 2023-01-08 13:47:38 +01:00
Sybren A. Stüvel
4b489dbde7 OAPI: add delete_requested_at in Job schema
If job deletion was requested, this field will contain the timestamp that
indicates when the request came in.
2023-01-08 13:45:57 +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
2e5f5ffadd OAPI: regenerate code 2023-01-04 01:18:21 +01:00
Sybren A. Stüvel
23afbfbea2 OAPI: add operation deleteJob 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
bb41889f1c OAPI: regenerate code 2023-01-04 01:18:21 +01:00
Sybren A. Stüvel
014c0d3b3d OAPI: add field to Job schemas to record storage info
Add fields to the job schemas (`SubmittedJob` and `Job`) to allow
storing the shaman checkout ID (so the Shaman checkout can be deleted
along with the job later).
2023-01-04 01:18:21 +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
c439bc3a1e OAPI: regenerate code 2022-10-20 13:13:22 +02:00
Sybren A. Stüvel
cdd304ffdb OAPI: add endpoint for a pre-flight job check
Add an endpoint that mimicks the job submission endpoint, to see whether
the job survives the job compiler script. This can be used to fail early,
before actually sending files to the farm.
2022-10-20 13:13:03 +02:00
Sybren A. Stüvel
c6ede93fc1 OAPI: regenerate code 2022-09-30 16:28:16 +02:00
Sybren A. Stüvel
07f0b38e8a OAPI: add operation to set job priority 2022-09-30 16:27:14 +02:00
Sybren A. Stüvel
0a1e1efc41 OAPI: regenerate code 2022-08-31 11:42:46 +02:00
Sybren A. Stüvel
48a1c06277 OAPI: add operation to get the shared storage, for current platform
Add an operation `getSharedStorage` that can return the shared storage
location, adjusted for the given audience & platform. This uses the
two-way variables system to adjust the Manager's configuration.
2022-08-31 11:38:14 +02:00
Sybren A. Stüvel
ffaaf78c8c OAPI: regenerate code 2022-08-31 08:58:47 +02:00
Sybren A. Stüvel
f7366c87ce OAPI: include "short version" in the FlamencoVersion schema
Include a `shortversion` property in the `FlamencoVersion` schema, which
will just be the version number with the release phase (and not the git
hash, the number of commits since the last tag, and the `-dirty` suffix).
2022-08-31 08:58:05 +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
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
458c33573e OAPI: regenerate code 2022-08-11 16:58:05 -07:00
Sybren A. Stüvel
99bf0a67a7 OAPI: add operation to delete workers
This will remove a worker by soft-deletion. Any task still assigned to
the worker will be requeued.

Note that this removal should only happen when the worker is offline, or
it will cause errors on the worker as its credentials will not be
accepted any more.
2022-08-11 16:50:05 -07:00
Sybren A. Stüvel
44ccc6c3ca Shaman: handle duplicate symlinks gracefully
Instead of erroring out when a symlink already exists, investigate it. If
the linked file is the one that's intended, just use it.

For some reason, BAT and/or the Flamenco add-on include some files twice
in the checkout request to Shaman. This is now handled gracefully.
2022-08-04 16:30:31 +02:00
Sybren A. Stüvel
1caa4c2a59 OAPI: regenerate code 2022-08-01 18:03:05 +02:00
Sybren A. Stüvel
e6f76f520b OAPI: include worker name in blocklist entries
To show the blocklist on the web interface, it's nice to identify workers
by their name and not just their UUID.
2022-08-01 18:02:21 +02:00
Sybren A. Stüvel
a6c935a634 Fix T99421: Introducing an etag for job types
The etag prevents job submissions with old settings, when the job
compiler script has been edited. The etag is the SHA1 hash of the
`JOB_TYPE` dictionary (as defined by the JavaScript file). The hash is
computed in a way that's independent of the exact formatting in the
JavaScript file. Also the actual JS code itself is irrelevant, just the
`JOB_TYPE` dictionary is used.
2022-07-29 21:13:37 +02:00
Sybren A. Stüvel
2a4e557bd9 OAPI: regenerate code 2022-07-26 10:28:28 +02:00
Sybren A. Stüvel
ed1a968691 OAPI: include "task" in fetchWorker response
Include the worker's current/last task in the response of the
`fetchWorker` operation.
2022-07-26 10:27:57 +02:00
Francesco Siddi
a2bd8a5615 OAPI: generate code 2022-07-25 17:16:53 +02:00
Francesco Siddi
3c22becc18 OAPI: rename wizard to setup-assistant
No functional changes, just a rename.
2022-07-25 17:14:21 +02:00
Sybren A. Stüvel
424b87d1d3 Shaman tests: ensure the temporary storage path is not a symlink
Shaman cannot handle cases where the storage path is a symlink (i.e. cases
where `filepath.EvalSymlinks(storagePath)` does not return `storagePath`).
This caused macOS devices to fail the unit tests, because macOS uses a
symlinked path for temporary files.

This commit changes the unit tests, to always use the real path instead of
the OS-provided symlink. This does *not* fix the actual issue in Shaman,
for that see T99965.
2022-07-25 13:03:46 +02:00
Sybren A. Stüvel
6731f96579 Shaman: better logging for garbage collector
Increase verbosity (debug → info) when checkout dir traversal fails, and
add a trace-level log for each file that is still in use. There were some
issues with symlinks, where the wrong paths were compared (see T99965) and
this log made it visible what was going wrong.
2022-07-25 13:01:49 +02:00
Sybren A. Stüvel
98555db1f6 OAPI: regenerate code 2022-07-22 11:58:13 +02:00
Sybren A. Stüvel
4c1a21f4a0 OAPI: when submitting a job, include the submitter's platform
The submitter's platform is used to perform two-way variable
replacement. The variables of that submitter's platform are looked up,
and their values are replaced with the variable names. This only applies
to the job's settings and metadata, and is only performed on prefixes.

For example, if the submitter's platform has a variable
`render = /shared/frames`, a job setting
`output = "/shared/frames/shot123"` will be stored as
`output = "{render}/shot123".

When a Worker gets a task of this job, `{render}` will be expanded to
the value appropriate for their platform, hence the "two-way" name.
2022-07-22 11:53:08 +02:00
Sybren A. Stüvel
043ca032cb OAPI: regenerate code 2022-07-19 17:19:10 +02:00
Sybren A. Stüvel
b6c6eee251 OAPI: add examples to some schemas
Add examples to the `WorkerSignOn` and `WorkerStateChanged` schemas.
These will make it easier to test with SwaggerUI, as they reflect a worker
signing on with the default task types.
2022-07-19 16:52:38 +02:00
Sybren A. Stüvel
f60849189a OAPI: Clean up FlamencoVersion schema definition
Change the `FlamencoVersion` schema definition so that it follows the style
of the other schema definitions:

- List properties before mentioning which are required.
- Put quotes around the property names, so that they stand out from the
  other YAML keys.
2022-07-18 17:47:57 +02:00
Sybren A. Stüvel
3133bd2487 OAPI: regenerate code 2022-07-17 17:25:53 +02:00
Sybren A. Stüvel
f23ba6d53e OAPI: correction to the sleep schedule example
The `days_of_week` field must be space-separated, not comma-separated.
2022-07-17 17:25:05 +02:00
Sybren A. Stüvel
0e92004f2a OAPI: regenerate code 2022-07-16 15:59:48 +02:00