887 Commits

Author SHA1 Message Date
Sybren A. Stüvel
b53cd67eb4 Cleanup: rename assertResponseEmpty()assertResponseNoContent()
The function tests the HTTP response is `204 No Content`, and now the
name reflects that better.

No functional changes.
2022-06-24 16:09:46 +02:00
Sybren A. Stüvel
27a6dde708 Manager: add local_storage package for managing storage locations
Add a `local_storage` package that finds a suitable place to put files.
Currently it just looks at the location of the currently running
executable; it can later do other things. It can be queried for directory
to put job-specific files.

It is intended to be used by the under-development "last rendered output"
processing system, to store an image file per job. Later we should also
refactor the task log handling system to use this.
2022-06-23 16:45:38 +02:00
Sybren A. Stüvel
fd730351b5 Crosspath: add IsRoot(path) bool function
Add a function that can determine whether the given path is considered
a "root path". Considers `/`, `X:`, `X:\` and `X:/` root paths, where `X`
is any upper or lower case Latin letters.
2022-06-23 16:40:46 +02:00
Sybren A. Stüvel
b441f3f3de Manager: load job compiler scripts from disk as well
If there is a `scripts` directory next to the current executable, load
scripts from that directory as well.

It is still required to restart the Manager in order to pick up changes
to those scripts (including new/removed files), PLUS a refresh in the
add-on.
2022-06-21 17:59:20 +02:00
Sybren A. Stüvel
87f1959e26 Manager: use blocklist to actually block workers
Actually use the blocklist in the task scheduler to block workers from
doing blocked job types.
2022-06-21 17:59:20 +02:00
Sybren A. Stüvel
20a2092ddf Cleanup: addon, fix mypy warning 2022-06-20 18:09:42 +02:00
Sybren A. Stüvel
a0e8eebcb3 Manager: make access to job compilers script thread-safe
When on-disk job compiler scripts are supported, they will be reloaded
often, and it becomes more important to have the access to the map of
loaded job compilers thread-safe.
2022-06-20 18:09:33 +02:00
Sybren A. Stüvel
a833064fc1 Addon: fix issue where invisible settings were not evaluated on submission
The code was still using the old `visible: true/false` approach, which
was replaced with a visibility string. The GUI and job submission code now
use the same function to determine visibility.
2022-06-20 18:08:44 +02:00
Sybren A. Stüvel
3541248551 Cleanup: addon, sort import-like code
Sort the `... = object` assignments that mimick the imports done when
mypy is doing its typechecking.
2022-06-20 18:05:20 +02:00
Sybren A. Stüvel
defa5b0431 Refactor: extract 'get the embedded filesystem' to a separate function
The global `scriptFS` variable was too easy to access, which caused an
issue where the mandatory `"scripts"` subdirectory was not passed.
Accessing via a getter function that hides this requirement prevents this.
2022-06-20 17:43:08 +02:00
Sybren A. Stüvel
201236cf46 Refactor: take some functions out of job_compilers.Service
Take some functions out of the `Service` struct, as they are more or less
standalone anyway. This will also make it easier later to make things
thread-safe, as that'll become important when files can get live-reloaded.
2022-06-20 17:26:17 +02:00
Sybren A. Stüvel
d5c527209f Cleanup: rename local var from compiler to service
The `Load()` function returns a `*Service`, and it was confusing that the
local variable is named `compiler` instead. Now it's called `service`.

No functional changes.
2022-06-20 17:21:19 +02:00
Sybren A. Stüvel
89fdc45b45 Manager: ignore small JS files
Empty (or almost-empty) JS files are ignored by the job compiler.
2022-06-20 17:14:06 +02:00
Sybren A. Stüvel
7a89c07fc9 Manager, refactor access to JS script files
Refactor the JS script file loading code so that it's tied to the `fs.FS`
interface for longer, and less to the specifics of our `embed.FS` instance.
This should make it possible to use other filesystems, like a real on-disk
one, to load scripts.
2022-06-20 17:06:46 +02:00
Sybren A. Stüvel
2d05e1c773 Fix unit test for recent scheduler change
Fix unit test for rF1586c37b.
2022-06-20 16:05:36 +02:00
Sybren A. Stüvel
380d55b4f0 Cleanup: rename job_compilers/path.go to js_path.go
Rename the file by adding `js_` suffix, to indicate it's for exposing a
"path" object to JavaScript.

No functional changes.
2022-06-20 15:57:03 +02:00
Sybren A. Stüvel
a7fbbf3313 Cleanup: rename job_compilers/process.go to js_process.go
Rename the file by adding `js_` suffix, to indicate it's for exposing a
"process" object to JavaScript.

No functional changes.
2022-06-20 15:56:09 +02:00
Sybren A. Stüvel
32e737466b Manager: clarify log message
Change "accepted CORS origins" to "acceptable CORS origins", as the former
is too ambiguous (it can mean "I just accepted these" or "These are the
acceptable ones").
2022-06-20 14:32:25 +02:00
Sybren A. Stüvel
1586c37b32 Manager: mark task as active as soon as it is assigned to a worker
Move the task to 'active' status so that it won't be assigned to another
worker. This also enables the task timeout monitoring.
2022-06-20 13:00:49 +02:00
Sybren A. Stüvel
2a4c9b2c13 Worker: enable SQLite foreign keys
They're not used now, but enabling them is good default behaviour anyway.
2022-06-20 13:00:49 +02:00
Sybren A. Stüvel
de5d12362d Manager: add sleep_repeats parameter to echo-sleep-test job type
This makes it convenient to create an arbitrary number of tasks.
2022-06-20 11:44:41 +02:00
Sybren A. Stüvel
e0b9866fd4 Web: resize columns after their data was updated
When data is updated, resize columns in the job/task/worker tables. For
example, status change requests of Workers require more space, for example
going from `awake` to `awake → offline`.
2022-06-20 11:44:08 +02:00
Sybren A. Stüvel
8bfe24cd96 Web: upgrade Tabulator 5.2.4 → 5.2.7 2022-06-20 11:21:42 +02:00
Sybren A. Stüvel
a2b667c043 Manager: log blocklist threshold 2022-06-17 17:15:23 +02:00
Sybren A. Stüvel
13bdb0ed73 Manager: remove outdated TODO 2022-06-17 17:15:13 +02:00
Sybren A. Stüvel
a368230afa Manager: fix race condition in logging of worker name/UUID
Instead of updating the logger in the context, just store a new logger
in a new sub-context.
2022-06-17 17:13:32 +02:00
Sybren A. Stüvel
21a294a267 FEATURES.md: mark task as done 2022-06-17 16:40:19 +02:00
Sybren A. Stüvel
ec55cf6ce1 FEATURES.md: more features 2022-06-17 16:37:06 +02:00
Sybren A. Stüvel
64c8fa851d Show assigned worker in task details
Show the worker assigned to the task in the task details view, as link
to the worker itself.
2022-06-17 16:36:55 +02:00
Sybren A. Stüvel
7327896db9 Worker: allow overriding worker name from environment
Allow overriding the worker name by setting the `FLAMENCO_WORKER_NAME`
environment variable. This makes it easy to do from Docker configs, and,
more importantly, from the scripts I use to run multiple workers on the
same machine while developing Flamenco.
2022-06-17 16:24:03 +02:00
Sybren A. Stüvel
857704c184 Web: worker nickname → name
See 55676b000efbd04cd895da9068f375dfad473ff4
2022-06-17 15:55:36 +02:00
Sybren A. Stüvel
cdb7789f08 Refactor: Manager, move test code
Move code that covers `worker_task_updates.go` into
`worker_task_updates_test.go`.

No functional changes.
2022-06-17 15:51:15 +02:00
Sybren A. Stüvel
046853932d Manager: re-queue previously failed tasks of worker when blocklisting
When a Worker is blocked from a job, re-queue its previously failed tasks
so that other workers can give them a try.
2022-06-17 15:49:16 +02:00
Sybren A. Stüvel
b95bed1f96 Refactor: rename RequeueTasksOfWorker to RequeueActiveTasksOfWorker
Soon there will be another function to requeue tasks of workers by other
criteria, so being clear in the name helps.

No functional changes.
2022-06-17 15:49:16 +02:00
Sybren A. Stüvel
fd31a85bcd Manager: add blocking of workers when they fail certain tasks too much
When a worker fails too many tasks, of the same task type, on the same job,
it'll get blocked from doing those.
2022-06-17 15:49:16 +02:00
Sybren A. Stüvel
56abc825a6 Refactor: Manager, refactor handling of task failures
Split the handling of soft and hard failures into separate functions.

No functional changes intended.
2022-06-17 15:01:52 +02:00
Sybren A. Stüvel
0396919229 FEATURES: add new way in which jobs can get stuck 2022-06-17 14:59:26 +02:00
Sybren A. Stüvel
6feee74c54 Cleanup: Manager, move worker task update handling code into its own file
Move the code related to task updates from workers to
`worker_task_updates.go`. It's going to get more complex with the
blocklisting in there; this prepares for that.

No functional changes.
2022-06-17 11:46:07 +02:00
Sybren A. Stüvel
50e795c595 FEATURES.md: mark 'clear task failure list' as done 2022-06-17 11:39:57 +02:00
Sybren A. Stüvel
81f81d0e0a Show task failure list in the web frontend
Show the task failure list in the web frontend's `TaskDetails` component.
2022-06-17 11:37:56 +02:00
Sybren A. Stüvel
7f14dac62f OAPI: regenerate code 2022-06-17 11:37:54 +02:00
Sybren A. Stüvel
aaed1e0589 OAPI: include task failure list in Task schema
Include the list of workers who failed this task in the `Task` schema.
2022-06-17 11:37:28 +02:00
Sybren A. Stüvel
0b5140fc5f Manager: clear task failure list on requeueing of jobs & tasks
When a job or task gets requeued from the web interface, its task
failure lists (i.e. the list of workers that previously failed this
task) will be cleared.

This clearing doesn't happen in other situations, e.g. when a worker
signs off and its task gets requeued, the task's failure list will
remain as-is.
2022-06-17 11:37:28 +02:00
Sybren A. Stüvel
d8be9d95e8 README: document task status meanings 2022-06-17 11:37:28 +02:00
Sybren A. Stüvel
e9fca8d993 Cleanup: typo fix in comment 2022-06-17 11:03:43 +02:00
Sybren A. Stüvel
b991e5f446 Cleanup: Manager, clarify some function names of the task state machine
Rename functions `onTaskStatusX` to `updateJobOnTaskStatusX` to clarify
their responsibility is to update the job in reaction to a task status
change.

No functional changes.
2022-06-17 11:01:41 +02:00
Sybren A. Stüvel
8764f8f7c1 Manager: task scheduler, don't schedule tasks the worker failed before
When a worker asks for a task to perform, don't give it a task that it
failed before.
2022-06-16 16:02:28 +02:00
Sybren A. Stüvel
ec10128f85 Worker: Sleep command, return error when sleep time is negative
I need a way to reliably generate task errors, and having a more thorough
check on the sleep duration parameter seemed a nice way to create those.
2022-06-16 15:46:03 +02:00
Sybren A. Stüvel
d5d0893b05 Worker: use explicit types for command parameter errors
Introduce `ParameterMissingError` and `ParameterInvalidError` structs, to
be returned from command executors. These replace free-form `fmt.Errorf()`
style errors.
2022-06-16 15:45:09 +02:00
Sybren A. Stüvel
8af1b9d976 Worker: fix sync issue in TestUpstreamBufferManagerUnavailable unit test
Fix synchronisation/goroutine issue in the "upstream buffer" test,
where very occasionally the queue size was checked at the wrong time.
2022-06-16 15:43:20 +02:00