Commit Graph

717 Commits

Author SHA1 Message Date
Jakub Kołodziejczak 89e6b1a63a chore(backend): allow disabling nsjail for unit tests (#742)
UC: as a developer I want to be able to test code w/o nsjail

bug: flaky test `test_go_job`
```
running 1 test
test worker::tests::test_go_job ... FAILED

failures:

---- worker::tests::test_go_job stdout ----
received killpill for worker 0
thread 'worker::tests::test_go_job' panicked at 'assertion failed: `(left == right)`
  left: `Object {"error": String("Error during execution of the script:\n\ngo: error obtaining buildID for go tool compile: pipe2: too many open files\ngo: error obtaining buildID for go tool compile: pipe2: too many open files\ngo: error obtaining buildID for go tool compile: pipe2: too many open files")}`,
 right: `String("hello world")`', src/worker.rs:2434:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

workaround: disable nsjail
2022-10-15 16:08:05 +02:00
Ruben Fiszel b7b5445874 add go-client mvp + stabilize openapi (#732) 2022-10-14 16:26:51 +02:00
Ruben Fiszel 7efd229b05 improve supercache 2022-10-13 03:04:55 +02:00
Ruben Fiszel d1d3403658 improve supercache 2022-10-13 01:23:08 +02:00
Ruben Fiszel 4dce71c877 improve supercache 2022-10-13 00:47:00 +02:00
Ruben Fiszel 2b134158f4 improve supercache 2022-10-13 00:15:21 +02:00
Ruben Fiszel 7488c419f7 fix supercache in presence of other deps 2022-10-12 23:28:50 +02:00
Jakub Kołodziejczak a5f545411f feat(backend): supercache for python heavy dependencies in alpha 2022-10-12 23:02:27 +02:00
Ruben Fiszel 953712d94e fix handle shared path not existing because job was resumed on another worker 2022-10-12 20:09:07 +02:00
Ruben Fiszel eb6d0084ab fix suspend + sleep with same worker 2022-10-12 15:56:15 +02:00
Ruben Fiszel c82004de00 feat: secure suspended resume event + configurable timeout (#721)
* fix suspend count for early message + delete resume_job

* all

* done everything

* done everything
2022-10-11 22:55:14 +02:00
Ruben Fiszel 6ea76b5a61 fix suspend count for early message + delete resume_job 2022-10-10 20:17:49 +02:00
Ruben Fiszel 0356384d4a add failed_jobs to retrystatus 2022-10-10 13:41:07 +02:00
Ruben Fiszel 45a563566e specify branch_chosen in openflow 2022-10-10 12:59:16 +02:00
Ruben Fiszel b87b03a673 feat(backend): implement new OpenFlow module Branches (#692)
* branches

* iterate

* branches

* progress

* progress

* progress

* done

* adapt frontend

* adapt frontend

* sqlx
2022-10-09 23:12:05 +02:00
Ruben Fiszel 430e22a4b4 feat: support struct in Go as script parameters #705 2022-10-08 20:03:08 +02:00
Ruben Fiszel a9f23d1ebf improve error messages 2022-10-08 14:36:21 +02:00
Ruben Fiszel adc64746b1 improve error messages 2022-10-08 14:22:34 +02:00
Ruben Fiszel 6cbc6b421b feat: add go LSP (#699)
* lsp

* progress

* 1.36.0
2022-10-08 13:28:46 +02:00
Ruben Fiszel 7f21147c8d feat(backend): separate properly logs from result 2022-10-07 19:54:44 +02:00
Ruben Fiszel 5bf169577c fix(backend): go lock dependency with no requirements 2022-10-07 16:11:45 +02:00
Ruben Fiszel a229e6f488 feat: sleep for arbitrary number of seconds statically or with a javascript expression (#691)
* progress

* progress

* fix serde

* fix frontend

* fix frontend
2022-10-07 04:09:32 +02:00
Ruben Fiszel 9a7cce1ab5 only stop wait on child on ok changes values 2022-10-06 23:37:10 +02:00
Ruben Fiszel 2198a64c0a fix: get info about kill reason 2022-10-06 23:25:49 +02:00
Ruben Fiszel 8ffc9dfe4c fix: get info about kill reason 2022-10-06 23:15:27 +02:00
Ruben Fiszel 8d8c9698a5 fix(backend): same_worker uses the same folder even within loops 2022-10-06 21:39:07 +02:00
Ruben Fiszel 8b60e9154c add GOMEMLIMIT to 2Gb 2022-10-06 05:13:06 +02:00
Ruben Fiszel 849842e9c6 feat: implement same_worker openflow attribute for running flow all in one go + sharing folder /shared (#689)
* init

* progress

* all

* sqlx

* remove unecessary test

* done

* frontend

* frontend
2022-10-06 04:59:09 +02:00
Ruben Fiszel 5b67da5cf5 spurrious printlns 2022-10-04 14:44:56 +02:00
Ruben Fiszel 4729cc8cc3 progress 2022-10-04 08:40:01 +02:00
Ruben Fiszel 3417325460 progress 2022-10-04 08:40:01 +02:00
Ruben Fiszel 84979527eb minor UI fixes 2022-10-02 21:35:07 +02:00
Ruben Fiszel 6bf1abf16e feat(backend): add WM_BASE_URL 2022-10-02 18:53:05 +02:00
Ruben Fiszel 75cf96b99f fix(backend): allow for now payload on resume GET 2022-10-02 05:14:36 +02:00
Ruben Fiszel 60e75e3b41 fix(go): make lines align with appended code 2022-10-02 01:28:14 +02:00
Ruben Fiszel 1d6dc484cd fix(go): inner_main is in a separate file rather than wrapped 2022-10-02 01:22:33 +02:00
Ruben Fiszel c3c965c478 feat(backend): add WM_FLOW_JOB_ID 2022-10-01 09:02:00 +02:00
Ruben Fiszel fd5921dc30 hotfix trusted host for pip-compile 2022-09-28 09:17:08 +02:00
Ruben Fiszel 7fd76265f7 feat: add private registries pip (#636)
* add private registries pip

* add private registries pip

* fix

* fix

* fix

* echo parameters
2022-09-28 08:47:43 +02:00
Ruben Fiszel a4f31bbdd6 do not restart flow as zombie job 2022-09-26 00:45:26 +02:00
Ruben Fiszel 04ab59f928 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 f1fdb4e0b9 fix cancel job 2022-09-25 16:36:32 +02:00
sqwishy c3ce89ec5f 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 45d0760ab9 remove delay between spawning each worker (#614) 2022-09-21 21:05:19 -07:00
Ruben Fiszel cdab7befcd more details on error handling job 2022-09-18 10:11:21 +02:00
sqwishy a4a583f4e3 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 Fiszel 9d991f968c 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 52ec744992 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 dc55d45bae 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 66df58af47 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