493 Commits

Author SHA1 Message Date
Sybren A. Stüvel
e34a0ba6ea Worker: more granular locking when flushing upstream buffer
Only lock the database mutex when actual queries are performed, but not
during the entire flush loop.
2022-04-21 19:19:01 +02:00
Sybren A. Stüvel
8937a6f06f Cleanup: worker, remove debug timers
Remove accidentally committed debug timing code.
2022-04-21 19:14:09 +02:00
Sybren A. Stüvel
bcbacf6c42 Worker: fix race condition getting logger with worker status 2022-04-21 19:12:53 +02:00
Sybren A. Stüvel
6bdc198301 Manager: more graceful errors when receiving task update of unknown task
Return a 404 Not Found when the task can't be found, and a 500 on other
errors.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
1176d85496 Worker: add -flush CLI option to just flush the buffer and quit
Add `-flush` CLI option to just flush the upstream queue and then quit.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
55d264632f Worker: completely flush upstream buffer at startup
Completely flush the upstream buffer at startup, before attempting to
fetch a new task. These updates could impact any task on the Manager side,
and first flushing the buffer before appending new updates also seems
like a good idea.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
90be370095 Manager: reduce password strength of Workers
The password check of worker API calls was 2 orders of magnitude slower
than actually handling the API call itself. Since the Worker authentication
is not that important (it's all on the same network anyway, and Worker
account registration is automatic too), lowering the BCrypt cost to the
minimum helps.

On my machine, this reduces the time for password checks from 50 to 2 ms.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
65427ee38e Manager: use e.NoContent(http.StatusNoContent) to return "no content"
No functional changes, just the right call for the job.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
d0e96ad7bd Web: hide the "delete job" action button
Hide the "Delete job" action button, as it has no backend implementation
yet.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
79bac3a5f3 Manager: fix race condition in logging of worker properties
Dereferencing the `w *persistence.Worker` pointer should happen directly
in the function call, not in the zerolog callback function.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
bb1acef054 Web: style action buttons and move the delete button to the last place 2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
eeb8305de0 Web: add button to requeue jobs 2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
698db0bf7c Web: Cleanup, abstract some code away into separate functions
No functional changes, just preparation for adding similar job actions.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
2e2184df62 Web: allow cancelling a job also after it failed
For task scheduling this doesn't matter, but for human workflow it can be
useful to differentiate between "failed" (and should be retried) and
"cancelled" (no longer relevant).
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
1ac37ab625 Web: clearer style for focused action button 2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
d84efb8c9a Web: implement 'Cancel Job' button
The button calls the 'setJobStatus' API endpoint to set the job status to
`cancel-requested`.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
1331d29b10 Makefile: mark new race-checker-enabled targets as 'phony' 2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
5a5a9aec8b Makefile: add rules for builds with race condition checker enabled
New rules `flamenco-manager_race` and `flamenco-worker_race` will build
with the race condition checker enabled.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
5466f65225 OAPI: add setJobStatus operation
Add API endpoint for updating the job status.
2022-04-21 19:06:18 +02:00
Sybren A. Stüvel
b699647ed4 OpenAPI: add activity field to Job schema 2022-04-21 12:40:25 +02:00
Sybren A. Stüvel
d79fde17f3 Manager: keep track of the reason of job status changes
To prepare for job status changes being requestable from the API, store
the reason for any status change on the job itself.

Not yet part of the API, just on the persistence layer.
2022-04-21 12:32:07 +02:00
Sybren A. Stüvel
954af37fd5 Manager: rename assertXXXResponse to assertResponseXXX
Rename test functions like `assertJSONResponse` to `assertResponseJSON`,
so that they get ordered together by autocompletion.

No functional changes.
2022-04-21 12:01:46 +02:00
Sybren A. Stüvel
c3b694ab2a Manager: wrap job/task errors in persistence layer
Avoid users of the persistence layer to have to test against Gorm errors,
by wrapping job/task errors in a new `PersistenceError` struct.

Instead of testing for `gorm.ErrRecordNotFound`, code can now test for
`persistence.ErrJobNotFound` or `persistence.ErrTaskNotFound`.
2022-04-21 11:54:59 +02:00
Sybren A. Stüvel
456a35dfc7 Update FEATURES.md
Some things are done, and added one item.
2022-04-21 10:48:59 +02:00
Sybren A. Stüvel
ac0127610c Gitignore .blend files that were submitted to Flamenco 2022-04-21 10:45:41 +02:00
Sybren A. Stüvel
2bc6b2bdba Web: start of notification bar
Use Pinia store for notifications. WIP, only the last one is shown in
the footer.
2022-04-19 16:27:05 +02:00
Sybren A. Stüvel
7b38aa4faf Web: add Job Actions Bar for action buttons
Add a bar for "job actions", i.e. buttons that do something with the
selected job(s).

Just has one button, and it doesn't do much either, but at least the
framework for these things is here.
2022-04-19 16:27:05 +02:00
Sybren A. Stüvel
2bbe1148b7 Web: Job details, avoid error when job data not yet loaded 2022-04-19 16:27:05 +02:00
Sybren A. Stüvel
27fb9d05db Web: use Pinia for storage of selected & current Job
Using the concept of 'selected' and 'active' similar to Blender.

Not all components have been altered to use the Pinia store yet.
2022-04-19 16:27:05 +02:00
Sybren A. Stüvel
4553be4d6c Web: different JS style for defining app data
Just a readability improvement.

No functional changes.
2022-04-19 16:03:36 +02:00
Sybren A. Stüvel
7bde1e243a Web: import from package-relative path
Use `@/path/to/file` instead of `./path/to/file`, as the former will be
valid even when used in a subdirectory (i.e. in cases where the latter
would have to change to `../path/to/file`). This makes imports uniform
and easier to copy-paste into other files.

No functional changes.
2022-04-19 16:03:36 +02:00
Sybren A. Stüvel
6655c2b3d7 Web: only use job type label if job type has been loaded 2022-04-19 11:34:13 +02:00
Sybren A. Stüvel
2e41d9a024 Web: show job type label instead of internal type name 2022-04-15 18:04:07 +02:00
Sybren A. Stüvel
64af9e4ae4 Web: add some handy debugging functions 2022-04-15 18:00:01 +02:00
Sybren A. Stüvel
4734e3c297 Web: filter settings based on job type definition
The web interface will now only show those settings that have `visible:
true`.

Probably it's a good idea to extend the job type, so that the visibility
can be controlled separately for job submission (i.e. the Blender
add-on) and job viewing (i.e. the web frontend).
2022-04-15 17:59:39 +02:00
Sybren A. Stüvel
0d94d7c20a Web: load job type info from backend
Load job type info from the backend, whenever the job type changes (i.e.
when a job is selected that has a different type than the previous one).
2022-04-15 17:22:10 +02:00
Sybren A. Stüvel
6f9a422511 Web: don't hammer server trying to reconnect 2022-04-15 17:22:10 +02:00
Sybren A. Stüvel
84e1ca9c67 Web: allow deselection of jobs
This ensures that deselecting a job also removes it from the job details
column.
2022-04-15 17:22:10 +02:00
Sybren A. Stüvel
78a3e5faf0 Web: header tweaks to get the layout a bit cleaner 2022-04-15 16:29:30 +02:00
Sybren A. Stüvel
d099a31531 OAPI: add endpoint for getting a single job type
This will be used by the web frontend to determine which job settings
to show and which to hide.
2022-04-15 16:21:48 +02:00
Sybren A. Stüvel
d30befa2d7 Manager: add assert function for testing JSON responses
This makes it much easier to test an API response actually matches the
expected JSON values.
2022-04-15 16:14:17 +02:00
Sybren A. Stüvel
5f019044ce Add caching of job compilers to FEATURES.md 2022-04-15 15:29:14 +02:00
Sybren A. Stüvel
70584ce951 OAPI: add sections to OpenAPI paths
This just makes the grouping a bit more obvious. It follows the already
available tags.
2022-04-15 15:11:29 +02:00
Sybren A. Stüvel
de3c4af8cb Manager: fix broken unit test 2022-04-15 14:37:41 +02:00
Sybren A. Stüvel
13e3607571 Manager: reduce logging of config loading
The logging was very verbose, and even though it was only at trace level,
a failing unit test would show them all.
2022-04-15 14:34:30 +02:00
Sybren A. Stüvel
4ea6f99c3e Manager: dynamically generate allowed CORS origins
Remove the hard-coded list of allowed CORS origins, and build it
dynamically from the list of "own URLs", i.e. the URLs at which the
Manager expects to be available.

This list of "own URLs" is constructed from the available network
interfaces.
2022-04-15 14:27:52 +02:00
Sybren A. Stüvel
1847c5219d Web: fix unexpected scrollbar on Firefox
Firefox will still have an additional 1px vertical line at the bottom of
the page, even when `#app` should take 100% of the vertical space. This
causes a scrollbar to show up. Setting the height at `calc(100vh - 1px)`
solves this.
2022-04-15 14:27:51 +02:00
Sybren A. Stüvel
5c28fcd1b7 Web: set colours on the html & body element
Setting the CSS `color` and `background-color` properties on the top-level
elements will make Firefox understand the dark theme, and colour the scroll
bar appropriately.
2022-04-15 14:27:24 +02:00
Sybren A. Stüvel
1535d7531b Document the use of SocketIO in README.md 2022-04-15 13:51:32 +02:00
Sybren A. Stüvel
315c7cfde7 Web: fix layout of jobs table
This ensures it uses virtual DOM, which is waaaaaaay faster.
CSS variables are used to compute the max height for the Jobs Table grid
cell, to make sure the Tabulator height can be set to 100% without
overflowing.
2022-04-14 09:54:57 +02:00