Commit Graph
178 Commits
Author SHA1 Message Date
Ruben Fiszel b87a498087 do not restart flow as zombie job 2022-09-26 00:45:26 +02:00
Ruben Fiszel 4044edf8d6 refactor logs panel everywhere applicable (#625)
* init

* init

* progress

* progress

* refactor logs entirely

* fix sqlx
2022-09-25 18:03:51 +02:00
Ruben Fiszel 3a530c8566 fix cancel job 2022-09-25 16:36:32 +02:00
sqwishy e7a6c1b99f reorganize handle_child (#606)
* reorganize handle_child

There were a couple issues with the current implementation:

1. When reading stdout and stderr from the child, as soon as we hit EOF
   on one we would stop reading from both (line 1420). This could lead
   to the return value not being read from the job program.

2. Lines read from stdout and stderr are put into a channel and read
   elsewhere with `rx.recv()` (line 1497) but that channel isn't read
   until empty.  It is only read in the `while !done.load(...)` (line
   1449) loop and that loop can stop after any `.store(true, ...)`.
   Which happens when the child exits, when the job is cancelled, when
   either stdout or stderr reach EOF...

   This can be verified by putting `dbg!(rx.recv().await)` or a similar
   assertion after the while loop before returning from that function.
   It shows the channel still containing log lines on rare occasions.

I was pretty careful in this to maintain the current behaviour; adding
comments to express intention.

One difference in this is that some regular intervals (cancel check and
ping update) should be more regular?

Before...

> at 00ms wait for 10ms
> at 10ms do things for 3ms
> at 13ms wait again for *10ms*
> at 23ms do things again ...

With change...

> at 00ms wait for 10ms
> at 10ms do things for 3ms
> at 13ms wait again but for *7ms*
> at 20ms do things again ...

Which I'm guessing is preferable but I could be wrong.

* renames; interpolate values in log messages

* do `append_logs()` in tokio::task

* tokio::time::interval & close pipe after limit

* clean up comments
2022-09-24 22:55:52 +02:00
sqwishy 47fba21256 remove delay between spawning each worker (#614) 2022-09-21 21:05:19 -07:00
Ruben Fiszel e1f54832fa more details on error handling job 2022-09-18 10:11:21 +02:00
sqwishy 126dd24c71 feat(backend): flow suspend resume (#522)
Flow observes `suspend` setting and will wait for resume messages sent for the job before continuing to the next step in a flow.

Adds endpoints under workspaces at `/jobs/<cancel|resume>/<job-uuid>` to either cancel or resume the job with a payload. For POST requests to the endpoint, payload is a JSON document. For GET requests to the endpoints, the payload is a base64url encoded JSON document as the value of the payload query parameter.
2022-09-14 11:46:57 -07:00
Ruben Fiszelandsqwishy 39918a9bb1 feat: implement go support (#571)
* progress

* progress

* all in one

* frontend

* small nits

* go job test

* go.sum is optional

* add golang-go to backend test image

Co-authored-by: sqwishy <somebody@froghat.ca>
2022-09-13 21:14:21 +02:00
Ruben Fiszel 110a25f6f8 fix: iterator input transform is made more generic (#524)
* fix: iterator expr is standardized with regular input transforms

* fix: iterator expr is standardized with regular input transforms

* v2
2022-09-13 20:11:00 +02:00
ex0ns 6f09405c2d feat(job): run job by hash (#551)
It was possible to run them using a webhook, but not through an endpoint.
This PR aims to fix that so the user can target a specific version of
the script to run.
2022-09-11 16:39:48 +02:00
Ruben Fiszel e9abcffdd1 feat: is_trigger is just a type tag, soon to include failure and command (#523)
* script kind

* all

* init code flow

* kind: trigger

* kind: trigger
2022-09-05 09:55:04 +02:00
Ruben Fiszel 482dc808ae logs around fetching job 2022-09-04 13:30:48 +02:00
Ruben Fiszel 12e2a31776 logs around job execution contain job id 2022-09-04 13:11:43 +02:00
Ruben Fiszel b6725dceca use local time for timeout 2022-09-04 13:05:39 +02:00
Ruben Fiszel 1bc12179c7 fix: last ping is set when the job is started avoiding erronous restart 2022-09-04 12:51:55 +02:00
sqwishyandRuben Fiszel d69d002b82 flow step retry feature (#493)
* flow step retry feature

* comparison constant on right side for clarity

* raise high retry values when starting a flow

also renamed duration to interval to be more specific about the retry
interval/period between tries or attempts

* add flow retry to openflow openapi

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2022-09-03 20:38:31 +02:00
Ruben Fiszelandsqwishy cf7209bdb9 feat: clean openflow spec v1 (#491)
* clean api 2

* the rest

* clean tests

* stop_after_if test

* unbox `modules: Vec<FlowModule>` in `ForloopFlow`

* migrate

* initFlow stop_after_if_expr and skip_if_stopped

* s/migrateInitTransform/migrateFlowModule

I didn't read the name before... oops

* sql migration for openflow changes

* fix frontend migration code

Co-authored-by: sqwishy <somebody@froghat.ca>
2022-09-02 01:26:39 +02:00
Ruben Fiszel 76f8165b82 pass language to completed job 2022-08-25 14:55:38 +02:00
Ruben Fiszel b8b1cc83ae list flow steps only on the tab 'all' 2022-08-23 15:18:44 +02:00
Ruben Fiszel 9498975fee add base_url to DENO_AUTH_TOKENS 2022-08-22 02:47:44 +02:00
Ruben Fiszel 35277160a6 feat: pass bearerToken as queryArg 2022-08-21 22:39:19 +02:00
Ruben Fiszel b9dfbfa2d8 feat: implicit types infered from default parameters 2022-08-21 22:01:24 +02:00
Ruben Fiszel da77d04094 fix: restart zombie jobs was restarting all jobs 2022-08-21 12:19:31 +02:00
Ruben Fiszel 1849cd8398 remove unecessary comment in worker 2022-08-21 12:10:03 +02:00
Ruben Fiszel 34e69bfe5d remove unecessary transaction in worker 2022-08-21 12:08:15 +02:00
Ruben Fiszel 1a552d1517 optimize python parsing + adding tests 2022-08-21 10:53:41 +02:00
Ruben Fiszel c0e9cd0564 fix: cancel a flow now does the expected behavior 2022-08-20 19:23:43 +02:00
Ruben Fiszel 0cd814cfec fix(backend): clear_schedule only clear non running jobs 2022-08-20 19:14:16 +02:00
Ruben Fiszel 77a685144d fix(backend): started_at info for completed_job is no more completed_at 2022-08-20 17:06:13 +02:00
Ruben Fiszel d99d4aaa92 optimize for python code having no imports 2022-08-20 16:21:04 +02:00
Ruben Fiszel e38cec3b17 fix collection on forloops + increase number of tests 2022-08-20 16:08:11 +02:00
Ruben Fiszel 00572668f1 feat: rely on PG time rather than worker time 2022-08-20 15:16:08 +02:00
sqwishy 32d067f8c0 feat(backend): failure_module (#452)
* run failure_module

- renames FlowModule.input_transform to input_transforms
- parse_deno_signature prints source on failure instead of debug
  representation of AST

* s/should_continue_job/should_continue_flow
2022-08-19 20:18:07 +02:00
sqwishy bae85732ff fix(backend): fixes forloop with 257 items only iterates once (#446)
usize as u8 will mask out the higher bits, so 0x100 as u8 is 0x00, 0x101
is 0x01 and only iterates once, etc....

refactors push_next_flow_job a bit
2022-08-19 17:14:46 +02:00
Ruben Fiszel 8c04558c4e pass BASE_INTERNAL_URL to the python process 2022-08-19 07:09:50 +02:00
Ruben Fiszel ea6f3c037c pass BASE_INTERNAL_URL to the deno process 2022-08-19 07:02:10 +02:00
Ruben Fiszel 9f02ca8dec fix export to tarball 2022-08-19 00:55:38 +02:00
Ruben Fiszel c2f616da0d use ts extension for private imports 2022-08-18 22:18:57 +02:00
Ruben Fiszel a5343fa959 feat: private imports 2022-08-18 21:49:24 +02:00
Ruben Fiszel 451bddf015 fix behavior of disable nsjail and disable nuser 2022-08-18 17:22:16 +02:00
Ruben Fiszel ae90c1cfed fix forloop empty no step afterward 2022-08-18 00:01:04 +02:00
Ruben Fiszel 561e13e51e fix: handle 0 length for-loops in the backend (#440)
* wip

* TODO

* my fix works I think
2022-08-17 15:56:49 +02:00
Ruben Fiszel 99594ff968 remove zendesk 2022-08-16 23:45:58 +02:00
Ruben Fiszelandsqwishy e606118943 fix(backend): collecting result when for loop is not the last step #422
* wip: step after forloop results

Adding a failing test so I don't forget out about it.

In the last step, `items` is `4`, the last item in iteration, rather
than the collected list.  My guess is this is because the results aren't
collected unless the flow quits early or the forloop module is the last
module so that `last_step` is true.

* test

Co-authored-by: sqwishy <somebody@froghat.ca>
2022-08-16 23:03:55 +02:00
Ruben Fiszel 824e91bbc7 pass path as env variable 2022-08-15 13:51:16 +02:00
Ruben Fiszel 064ae59338 make executable paths configurable 2022-08-15 13:32:51 +02:00
Ruben Fiszel 1275f5f7fb fix: set secure only for https 2022-08-15 10:40:01 +02:00
Ruben Fiszel 92d1a3a441 remove hardcoded paths when nsjail is disabled 2022-08-15 10:08:40 +02:00
Ruben Fiszel 1b377f8f02 set local authorization -> set role 2022-08-14 23:33:09 +02:00
Ruben Fiszel 1c40f01e5d feat: db users: admin -> windmill_admin, app -> windmill_user (#404)
* feat: db users: admin -> windmill_admin, app -> windmill_user

* clean up

* backend tests

* backend tests

* backend tests

* lock roles in first migration

* check if user is superuser too

* add init-db

* add init-db
2022-08-14 18:20:27 +02:00