Commit Graph

35 Commits

Author SHA1 Message Date
70faa4e225 Move URLs to the Flamenco website to constants in a dedicated package
Create a dedicated package `.../pkg/website` to contain constants for the
URLs of documentation, bug reporting, etc. That way it's easier to see
which parts of the website are being referred to from the Flamenco
binaries, and updates can happen in a central spot.

No functional changes.
2024-01-25 12:25:06 +01:00
aa4d3cff75 Windows: check user's system privileges when Shaman is enabled
Symbolic links on Windows require some special user privilege, and
Shaman can now check for this at startup. Hopefully this helps in guiding
people towards a working Shaman system.
2023-10-16 21:36:16 +02:00
40f76efec9 Shaman: log a warning on platforms that don't reliably support symlinks
Windows 10 Home does not support symlinks, and Shaman will cause errors
unless running as admin (which is not recommended for security reasons).
Now Flamenco Manager will log a warning when Shaman is enabled on this
platform.
2023-10-15 14:37:15 +02:00
d60af809be Shaman: skip certain tests if the platform cannot do symlinking reliably
Windows 10 Home ("Core") only allows symlinking when running as admin,
which is not recommended for Flamenco Manager. Instead of failing unit
tests on this system, simply skip them. This reduces noise when developing
on this platform (i.e. my personal laptop) a lot.
2023-10-15 14:26:32 +02:00
02fac6a4df Change Go package name from git.blender.org to projects.blender.org
Change the package base name of the Go code, from
`git.blender.org/flamenco` to `projects.blender.org/studio/flamenco`.

The old location, `git.blender.org`, has no longer been use since the
[migration to Gitea][1]. The new package names now reflect the actual
location where Flamenco is hosted.

[1]: https://code.blender.org/2023/02/new-blender-development-infrastructure/
2023-08-01 12:42:31 +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
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
472b73eb5c Cleanup: run go fmt ./...
No functional changes.
2023-04-17 16:36:52 +02:00
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
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
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
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
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
fb89658530 Refactor: replace os.IsNotExist() with errors.Is(err, fs.ErrNotExist()
`os.IsNotExist()` is from before `errors.Is()` existed. The latter is the
recommended approach, as it also recognised wrapped errors.

No functional changes, except for recognising more cases of "does not
exist" errors as such.
2022-06-28 10:24:46 +02:00
1fc71ccf92 Manager: reduce log level 2022-05-06 14:35:27 +02:00
e70dad2177 Manager: unify Flamenco and Shaman storage paths
Flamenco Manager now has a "storage path" config option, which will be
used by Shaman if enabled. Now the `{jobs}` implicit variable will always
exist, its value depending on whether Shaman is enabled or not.
2022-04-01 13:43:51 +02:00
88fe62ddef Manager: skip shaman permission unit test on Windows
The test was made with umask on UNIX-like systems in mind. It doesn't
make much sense on Windows, at least not in its current form, so it's
better to just explicitly skip it.
2022-03-28 11:33:09 +02:00
1b11233c92 Shaman: more path -> filepath
Just more Windows fixes.
2022-03-28 11:11:50 +02:00
fe9849b134 Shaman: fix bunch of path issues on Windows
Shaman was made on Linux, using the `path` module, which only supports
forward slashes. This mostly replaces `path` with `path/filepath` to use
native paths and increase Windows compatibility.

The work isn't done yet, though.
2022-03-28 11:02:18 +02:00
a6834137b7 Tests: test some more returned errors 2022-03-26 14:07:49 +01:00
3905135465 Tests: replace assert.Nil(t, err) with assert.NoError(t, err)
This is a better way to check errors, both semantically (no usually nil is
bad, but nil error is good, so this avoids a mental negation) and for
the reporting by the assert package.
2022-03-26 14:05:53 +01:00
6c827ffc52 Shaman: only configure the root directory of the Shaman files
Flamenco v2 allowed separate configuration of the Shaman file store and
checkout paths. This is now just one setting for "the storage". The file
store will be in `{storage}/file-store` and the checkout will happen in
`{storage}/jobs`.
2022-03-25 14:32:42 +01:00
4b9501590e Shaman: only add random suffix to checkout dir if already existing
Only add a random suffix to the checkout dir if it is necessary to ensure
uniqueness. If the client-supplied checkout directory doesn't exist yet,
it will be used as-is.
2022-03-25 14:10:26 +01:00
724938c7ae Shaman: allow Manager to determine the final checkout path
The checkout request now responds with the final checkout path. This makes
it possible for the Manager to ensure the checkout is unique.
2022-03-25 14:10:26 +01:00
2e4ada2ade Manager: add 'shaman' prefix to logging 2022-03-25 14:10:26 +01:00
7e035ec3bf Manager: check returned error of touchfile call 2022-03-25 14:10:26 +01:00
ccf45f2f6c Manager: add Shaman checkout test 2022-03-25 14:10:26 +01:00
c69e0909ae Shaman submission is working! 2022-03-25 14:10:26 +01:00
f9b7510c42 Streamlining Shaman protocol further, plus rough implementation for addon 2022-03-25 14:10:26 +01:00
b2288e7f28 Manager: More work on Shaman support
This introduces some more conceptual changes to Shaman. The most important
one is that there is no longer a "checkout ID", but a "checkout path".
The Shaman client can request any subpath of the checkout directory,
so that it can handle things like project- or scene-specific prefixes.
2022-03-25 14:10:26 +01:00
2b0d154a07 Manager: more work on Shaman integration 2022-03-25 14:10:26 +01:00
6f35b3303d Manager: more work on porting Shaman code to Flamenco 3 2022-03-25 14:10:26 +01:00
Sybren A. Stüvel
4e8e71e4e2 Initial checkin of Shaman of Flamenco 2
This is not yet working, it's just a direct copy of the Manager of Flamenco
2, with Logrus replaced by Zerolog. The API has been documented in
flamenco-manager.yaml as a starting point for the integration.
2022-03-25 14:10:26 +01:00