48 Commits

Author SHA1 Message Date
Sybren A. Stüvel
183bb23d2a Tests: sleep test using bigger time steps
Since every mocked clock time step also waits for 1ms to give other
goroutines a chance to run, it took too much wallclock time to mock-sleep
for 47 seconds with 100ms increments.

Stepping the mocked clock with 1s increments makes the test 10x faster.
2022-03-04 12:35:01 +01:00
Sybren A. Stüvel
cd2fe8170e Errors: remove "error" prefix from message
Instead of returning an error "error doing X", just return "doing X". The
fact that it's returned as an error object says enough about that it's
an error.

This also makes it easier to chain error messages, without seeing the
word "error" in every part of the chain.
2022-03-04 11:30:31 +01:00
Sybren A. Stüvel
a7654394b4 Worker: update default task types to match what's currently in use
Flamenco v2 had a different classification of task types than Flamenco v3,
and the defaults still referenced the v2 classifications.
2022-03-03 11:51:53 +01:00
Sybren A. Stüvel
47e36c927c Change package URL to the blender.org repository 2022-03-01 20:45:09 +01:00
Sybren A. Stüvel
b5b7b228ed Worker: capture panics in 'active' state and cleanly sign off before dying 2022-02-28 12:07:10 +01:00
Sybren A. Stüvel
2a1f5a0df4 Worker: buffer task updates when Manager offline
Queue task updates in an SQLite database when the Manager is
unreachable, periodically checking whether they can be flushed.
2022-02-22 19:05:33 +01:00
Sybren A. Stüvel
e948c5d936 Worker: avoid prematurely exiting 'awake' state 2022-02-22 19:01:01 +01:00
Sybren A. Stüvel
5c3a5124f3 Cleanup: add missing comment 2022-02-22 19:00:44 +01:00
Sybren A. Stüvel
b462e8db1a Worker: wrap api.ClientWithResponsesInterface in a local interface
This makes it possible to locally create a mock object for the API client.
2022-02-22 17:13:04 +01:00
Sybren A. Stüvel
a650aa4cbd Worker: Blender command, don't put current time in log lines
The time has to be put in at a different abstraction level.
2022-02-22 15:36:20 +01:00
Sybren A. Stüvel
adf7113b34 Worker: log chunker, also flush log after certain time
This flushes the log when the previous `Append()` call was too long ago.
Note that this doesn't flush after X seconds of silence; a call to
`Append()` or `Flush()` still has to happen in order to do the flushing.
2022-02-22 15:34:37 +01:00
Sybren A. Stüvel
45a95ca4c2 Worker: use time service to log current time 2022-02-22 15:33:30 +01:00
Sybren A. Stüvel
66186e460e Worker: upload logs in chunks to Manager 2022-02-22 15:17:35 +01:00
Sybren A. Stüvel
9a5047a94d Worker: move command_exe.go interface definitions 2022-02-22 14:42:57 +01:00
Sybren A. Stüvel
0525bd726c Worker: actually execute blender and log its output 2022-02-22 13:55:28 +01:00
Sybren A. Stüvel
32c7a1fd84 Worker: Blender command, parse CLI arguments from 'exe' parameter 2022-02-22 12:52:16 +01:00
Sybren A. Stüvel
db4505e5fd Cleanup: move Blender command param parsing to its own function 2022-02-22 12:38:25 +01:00
Sybren A. Stüvel
20965691d0 Add test for Blender command and better command parameter parsing 2022-02-22 12:36:37 +01:00
Sybren A. Stüvel
e9a94eecae Worker: add CLI runner interface and move test/mock code around a bit 2022-02-22 12:35:43 +01:00
Sybren A. Stüvel
77f1e02c75 Worker: add CommandLineRunner interface for executing CLIs
Not yet used, but interface is there + mocked for testing.
2022-02-22 11:48:29 +01:00
Sybren A. Stüvel
b986fa49d8 Worker: clean up some logging 2022-02-21 19:07:20 +01:00
Sybren A. Stüvel
e5e466931b Worker: better way to get array command parameters 2022-02-21 18:04:17 +01:00
Sybren A. Stüvel
ef2bbd2845 Unified Command field names
Some parts of Flamenco had a Command consist of "name + settings", and
other parts used "type + parameters" (with the same semantics). This is
now unified to "name + parameters".
2022-02-21 18:03:51 +01:00
Sybren A. Stüvel
e03e111603 Cleanup: move license declaration comment 2022-02-21 15:42:15 +01:00
Sybren A. Stüvel
9eaae2451b Rename command_exe_test.go to command_misc_test.go 2022-02-18 11:45:37 +01:00
Sybren A. Stüvel
00571ad480 Worker: allow float64 for sleep duration
The sleep will still be truncated to entire seconds.
2022-02-18 11:45:24 +01:00
Sybren A. Stüvel
f6437be844 Worker: implement fail/completed/log task updates 2022-02-18 11:41:46 +01:00
Sybren A. Stüvel
3057a009e7 Worker: better handling of task update errors 2022-02-17 14:02:45 +01:00
Sybren A. Stüvel
ff73f325c8 Worker: clearer errors when listener call fails 2022-02-17 13:58:10 +01:00
Sybren A. Stüvel
fef0a3cb17 Worker: Remove 3rd party code for adding Basic HTTP auth header 2022-02-17 13:58:10 +01:00
Sybren A. Stüvel
66c052d9fd Move worker config, sign-on, and registration code into worker package
This makes the `main.go` file simpler, and not depend on any other files
in the `main` package. For some reason, the debugger really likes this.
2022-02-17 13:58:10 +01:00
Sybren A. Stüvel
71edb139dd Start working on blender-render command
The command doesn't actually execute anything yet.
2022-02-17 13:58:10 +01:00
Sybren A. Stüvel
3723e89f23 Extract commands into a file based on their "command type" 2022-02-17 10:54:34 +01:00
Sybren A. Stüvel
ecd658d50d Cleanup: shorten filename from ..._executor.go to ..._exe.go 2022-02-17 10:52:47 +01:00
Sybren A. Stüvel
e539d04320 Cleanup: remove unused code 2022-02-17 10:49:43 +01:00
Sybren A. Stüvel
4f184a546f Use gomock to test command executor listener
This also requires that `TaskID` is no longer a custom type, because that
would cause import cycles. The alternative would be to put the generated
mocks directly into the `worker` package, but I didn't think that was
particularly nice. Maybe this'll be reconsidered later.
2022-02-17 10:47:52 +01:00
Sybren A. Stüvel
270c54fdb7 More status change acks & checks to get stable flow between worker states 2022-02-15 17:46:37 +01:00
Sybren A. Stüvel
d6df00db3e Worker: Fix code flow in 'asleep' state 2022-02-15 15:56:15 +01:00
Sybren A. Stüvel
50088b4c94 Save worker info on sign-on (not just on registration) 2022-02-15 10:57:29 +01:00
Sybren A. Stüvel
aa41ae2ba2 Worker: remove fixed error returns from listener 2022-02-14 18:01:48 +01:00
Sybren A. Stüvel
f5254c1c65 Change sleep 'time_in_seconds' to 'duration_in_seconds' 2022-02-14 14:54:03 +01:00
Sybren A. Stüvel
8af041fe44 Cleanup: remove some unused code & add some comments 2022-02-14 14:47:54 +01:00
Sybren A. Stüvel
22f2084e89 Unit tests for 'echo' and 'sleep' commands 2022-02-14 14:47:41 +01:00
Sybren A. Stüvel
ad4313b93f Untested command runner with 'sleep' and 'echo' commands 2022-02-11 17:09:58 +01:00
Sybren A. Stüvel
cf8ba835aa Added framework for task & command execution 2022-02-11 16:51:28 +01:00
Sybren A. Stüvel
be89349632 Very basic non-functional framework for a task runner
Also has some login/logout functionality for storing stuff in the DB.
2022-01-31 16:05:27 +01:00
Sybren A. Stüvel
7c14b2648d Much more of the Worker life cycle implemented 2022-01-31 15:02:05 +01:00
Sybren A. Stüvel
c501899185 Ported lots of stuff from gitlab.com/dr.sybren/flamenco-worker-go
Much isn't working though.
2022-01-28 17:02:50 +01:00