Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 1.0 (worker, engine, cli, runtime) #592

Merged
merged 138 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
4f26afc
engine: spike mapping console logs to an adaptor logger
josephjclark Jan 30, 2024
201d528
runtime: messy tweak to module loading
josephjclark Jan 30, 2024
1780329
engine,runtime: revert linker change and fix tests
josephjclark Jan 30, 2024
058eff2
engine: track test file
josephjclark Jan 30, 2024
649ca43
logger: dont stringify json output AND serialize errors
josephjclark Jan 31, 2024
deee94b
logger: tidy
josephjclark Jan 31, 2024
271f1a8
engine: don't parse json logs coming out of the logger
josephjclark Jan 31, 2024
3877474
engine, worker: better handling of objects coming from the logger
josephjclark Jan 31, 2024
bdf2586
engine: fix tests
josephjclark Jan 31, 2024
d13adfb
logger: tests and types
josephjclark Jan 31, 2024
593ebd5
cli: update test
josephjclark Jan 31, 2024
d8e8ee3
engine: types
josephjclark Jan 31, 2024
a60a83e
worker: update tests
josephjclark Jan 31, 2024
0d9804e
logger: set a special json emitter so that json logs get nicely print…
josephjclark Jan 31, 2024
99defcd
logger: fix types
josephjclark Jan 31, 2024
94c900f
logger: log all json to .log
josephjclark Jan 31, 2024
77bab1a
tests: fixes
josephjclark Jan 31, 2024
1313b09
logger: fix tests
josephjclark Jan 31, 2024
63a251a
logger: serialise print() properly
josephjclark Jan 31, 2024
8024831
logger: types
josephjclark Jan 31, 2024
bf610e7
engine: fix logs to gcp
josephjclark Jan 31, 2024
6cc50fc
test: update log handling
josephjclark Jan 31, 2024
502eaef
engine: fix passing test
josephjclark Jan 31, 2024
4b080c0
runtime: add tests on job logger and errors
josephjclark Jan 31, 2024
6e18805
logger: improve detection of error objects
josephjclark Jan 31, 2024
32aed67
engine: tests on error logging
josephjclark Jan 31, 2024
63baf52
Merge branch 'main' into handle-adaptor-logs
josephjclark Feb 1, 2024
2f80a78
engine: restore adaptor logger
josephjclark Feb 1, 2024
823b471
changesets
josephjclark Feb 1, 2024
b76266e
Tidy ups
josephjclark Feb 1, 2024
425c515
engine: refactor log messages (and be a bit more lenient about struct…
josephjclark Feb 1, 2024
2fb6493
worker: simplify logging
josephjclark Feb 1, 2024
7cd9e5e
tiny tidyups
josephjclark Feb 1, 2024
0d93290
Merge pull request #581 from OpenFn/handle-adaptor-logs
josephjclark Feb 1, 2024
909cf3e
remove old docs
josephjclark Feb 1, 2024
9956032
lexicon: start building a central lexicon of definitions
josephjclark Feb 1, 2024
c996c98
runtime: huge refactor of runtime core API
josephjclark Feb 1, 2024
cf61d6a
runtime: more refactoring
josephjclark Feb 2, 2024
da7c609
runtime: take initial state out of the execution plan
josephjclark Feb 2, 2024
5f3e75a
fix tests
josephjclark Feb 2, 2024
5eae3ec
runtime: changeset
josephjclark Feb 2, 2024
fbdd43f
runtime: extra type tweakings
josephjclark Feb 2, 2024
e9dacc4
runtime: readme
josephjclark Feb 2, 2024
372ae3d
runtime: jobs -> steps (mostly)
josephjclark Feb 2, 2024
a33362d
cli: start refactoring towrads new runtime API
josephjclark Feb 2, 2024
925bd8f
cli: basically get the CLI working again
josephjclark Feb 3, 2024
0ac21f6
cli: types
josephjclark Feb 3, 2024
cb21bfc
cli: fix a bunch of tests, update workflow parsing
josephjclark Feb 3, 2024
03bbf16
cli: fix execute and compile tests
josephjclark Feb 5, 2024
27e0608
cli: more test fixes
josephjclark Feb 5, 2024
9065e6a
fix more cli tests
josephjclark Feb 5, 2024
161288e
cli: fix integration tests
josephjclark Feb 5, 2024
0e22a0d
cli: tidy
josephjclark Feb 5, 2024
8dc1741
runtime: remove strict mode
josephjclark Feb 5, 2024
152129d
remove strict mode
josephjclark Feb 5, 2024
ca6a60d
cli: default workflow name to the file name
josephjclark Feb 5, 2024
dc1dbc6
runtime: tweak log output
josephjclark Feb 5, 2024
7e71d5d
cli: remove log
josephjclark Feb 5, 2024
20b43e4
cli: types
josephjclark Feb 5, 2024
39001c2
docs
josephjclark Feb 6, 2024
abc0307
deploy: adjust logging
josephjclark Feb 6, 2024
b37ae0f
engine: update types
josephjclark Feb 6, 2024
bb35156
engine: update names and types
josephjclark Feb 6, 2024
e3a249e
runtime: male statePropsToRemove a system options, rather than workfl…
josephjclark Feb 6, 2024
81ce00e
engine: restore statePropsToRemove tests
josephjclark Feb 6, 2024
15898e9
mock: update to lexicon
josephjclark Feb 7, 2024
8176558
worker: start mapping to lexicon. Handled run-> plan conversion
josephjclark Feb 7, 2024
6b5583b
worker: typings
josephjclark Feb 7, 2024
f4b54af
worker: fix all tests
josephjclark Feb 7, 2024
487c172
engine: types
josephjclark Feb 7, 2024
9386919
worker: fix cheeky test
josephjclark Feb 8, 2024
6e2db1b
tests: fix cli tests
josephjclark Feb 8, 2024
03db316
worker: update test
josephjclark Feb 8, 2024
48ff588
package lock
josephjclark Feb 8, 2024
b0694fd
tests: update test
josephjclark Feb 8, 2024
ac8acd6
changesets and housekeeping
josephjclark Feb 8, 2024
eef617c
more housekeeping
josephjclark Feb 8, 2024
92ee525
engine: tweak test
josephjclark Feb 8, 2024
ba7ac08
runtime: tweak error messages
josephjclark Feb 8, 2024
a5958c8
worker: stricter type checkign on tests
josephjclark Feb 8, 2024
0e742c8
fix test
josephjclark Feb 8, 2024
68fb396
typing in worker tests
josephjclark Feb 8, 2024
81c4b34
worker: update channel mock
josephjclark Feb 8, 2024
f2a530b
lexicon: docs
josephjclark Feb 8, 2024
e9287c0
Run -> LightningPlan
josephjclark Feb 8, 2024
2bdb92f
version bumps for logger and mock
josephjclark Feb 8, 2024
bb2fc32
mock: return error if dataclip not found
josephjclark Feb 9, 2024
33e72f8
worker: better handling of dataclip errors
josephjclark Feb 9, 2024
1da18fb
lightning-mock: fix test
josephjclark Feb 9, 2024
a97eb26
worker: changeset
josephjclark Feb 9, 2024
21365ea
worker: fix test
josephjclark Feb 9, 2024
14b2178
worker: fix test again
josephjclark Feb 9, 2024
86dd668
Backend renaming (1.0 version bumps plus the lexicon) (#585)
josephjclark Feb 9, 2024
10e6b6c
Merge branch 'release/1-0' into fix-dataclip-errors
josephjclark Feb 9, 2024
7a1049d
cli: dont print compiler,runtime versions, also show monorepo for ada…
josephjclark Feb 9, 2024
5143d93
cli tweak output to optionally show components
josephjclark Feb 9, 2024
78cfc5d
worker: simplify version output
josephjclark Feb 9, 2024
a0823f2
mock: resolve conflict
josephjclark Feb 9, 2024
5f4e437
Merge pull request #595 from OpenFn/fix-dataclip-errors
josephjclark Feb 9, 2024
8ab27c9
Merge pull request #596 from OpenFn/tidy-version-output
josephjclark Feb 9, 2024
101f5a1
Autoinstall by default (#594)
josephjclark Feb 9, 2024
858d07e
openfnx: update console output
josephjclark Feb 13, 2024
3e49146
Merge branch 'release/1-0' of github.com-josephjclark:OpenFn/kit into…
josephjclark Feb 13, 2024
cf9abea
Merge branch 'main' into release/1-0
josephjclark Feb 13, 2024
c7f2b3e
runtime: fix tests
josephjclark Feb 13, 2024
cc8b9db
worker: support output_dataclips on run options
josephjclark Feb 13, 2024
97b3816
worker: additioonal test of output_dataclips
josephjclark Feb 13, 2024
31c9723
types
josephjclark Feb 13, 2024
e48998c
Merge pull request #599 from OpenFn/no-output-dataclips
josephjclark Feb 13, 2024
45ddbe0
mock: error if a credential does not exist
josephjclark Feb 14, 2024
4a2eee1
engine: throw nice exception if credentials fail to load
josephjclark Feb 14, 2024
59c1d7d
tests: add tset for bad credential
josephjclark Feb 14, 2024
71677cc
worker: bad credential test
josephjclark Feb 14, 2024
cf8b242
mock: update dev endpoint to allow invalid credentials
josephjclark Feb 14, 2024
ea6fc05
changeset
josephjclark Feb 14, 2024
699a8e2
worker: move tesdt into reasons
josephjclark Feb 15, 2024
37493c1
worker: tweak logs
josephjclark Feb 15, 2024
ab156dc
Merge pull request #601 from OpenFn/fetch-credential-errors
taylordowns2000 Feb 15, 2024
29bff41
Verify run token (#598)
josephjclark Feb 15, 2024
b904614
version lock pheonix to 1.7.10
josephjclark Feb 15, 2024
9f6c35d
logger: add proxy function to the mock
josephjclark Feb 15, 2024
e71d28b
engine: don't send adaptor logs to stdout
josephjclark Feb 15, 2024
6ccf2c4
tests: add test for adaptor logs
josephjclark Feb 15, 2024
5f24294
changeset
josephjclark Feb 15, 2024
c619dd2
tests: remove logging
josephjclark Feb 15, 2024
c1512cc
types
josephjclark Feb 15, 2024
f5738b8
logger: rethink mock proxy. It's still not working.
josephjclark Feb 15, 2024
968d6f9
logger: fix mock proxy function
josephjclark Feb 15, 2024
3dd2075
engine: fix tests
josephjclark Feb 15, 2024
21119c5
tests: update tests
josephjclark Feb 15, 2024
322813c
worker: fixed a tricky issue with server shutdown
josephjclark Feb 15, 2024
b7f01fd
package lock
josephjclark Feb 15, 2024
ceda2e9
package lock
josephjclark Feb 15, 2024
184a60e
tests: tweak output
josephjclark Feb 15, 2024
c41f7f5
tests: run serially
josephjclark Feb 15, 2024
854a586
tests: reorganise
josephjclark Feb 15, 2024
b62c76e
Merge pull request #605 from OpenFn/private-adaptor-logs
josephjclark Feb 15, 2024
56be004
version: [email protected] [email protected]
josephjclark Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build/install-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const outputPath = process.argv[2] || './dist';

// Package everything up like a local build
exec('git branch --show-current', {}, async (err, branchName) => {
console.log('Installing openfnx for branch:', branchName);
console.log();
const files = await findPackages();
const pkgs = mapPackages(files);
await ensureOutputPath(outputPath);
Expand All @@ -37,9 +39,13 @@ exec('git branch --show-current', {}, async (err, branchName) => {
).then(async () => {
const cliPath = getLocalTarballName(pkgs['@openfn/cli']);
const command = `npm install -g ${path.resolve(outputPath, cliPath)}`;
console.log(command);
//console.log(command);

await exec(command);
// install the local CLI globally

console.log();
console.log('openfnx installed successfully! To test:');
console.log(' openfnx --version');
});
});
2 changes: 1 addition & 1 deletion integration-tests/cli/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.serial('openfn version', async (t) => {
test.serial('openfn test', async (t) => {
const { stdout } = await run(t.title);
t.regex(stdout, /Versions:/);
t.regex(stdout, /Running test job.../);
t.regex(stdout, /Running test workflow/);
t.regex(stdout, /Result: 42/);
});

Expand Down
7 changes: 4 additions & 3 deletions integration-tests/cli/test/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ import test from 'ava';
import path from 'node:path';
import run from '../src/run';
import { extractLogs, assertLog } from '../src/util';
import { stderr } from 'node:process';

const jobsPath = path.resolve('test/fixtures');

// These are all errors that will stop the CLI from even running

test.serial('job not found', async (t) => {
test.serial('expression not found', async (t) => {
const { stdout, err } = await run('openfn blah.js --log-json');
t.is(err.code, 1);

const stdlogs = extractLogs(stdout);

assertLog(t, stdlogs, /job not found/i);
assertLog(t, stdlogs, /failed to load the job from blah.js/i);
assertLog(t, stdlogs, /expression not found/i);
assertLog(t, stdlogs, /failed to load the expression from blah.js/i);
assertLog(t, stdlogs, /critical error: aborting command/i);
});

Expand Down
45 changes: 12 additions & 33 deletions integration-tests/cli/test/execute-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ test.serial(
}
);

// Run a new-style execution plan with custom start
test.serial(`openfn ${jobsPath}/plan.json -i`, async (t) => {
const { err } = await run(t.title);
t.falsy(err);

const out = getJSON();
t.deepEqual(out.data.userId, 1);
});

test.serial(`openfn ${jobsPath}/wf-conditional.json`, async (t) => {
const { err } = await run(t.title);
t.falsy(err);
Expand Down Expand Up @@ -124,36 +133,6 @@ test.serial(
}
);

test.serial(`openfn ${jobsPath}/wf-strict.json --strict`, async (t) => {
const { err } = await run(t.title);
t.falsy(err);

const out = getJSON();
t.deepEqual(out, {
data: {
name: 'jane',
},
});
});

test.serial(`openfn ${jobsPath}/wf-strict.json --no-strict`, async (t) => {
const { err } = await run(t.title);
t.falsy(err);

const out = getJSON();
t.deepEqual(out, {
x: 22,
data: {
name: 'jane',
},
references: [
{
name: 'bob',
},
],
});
});

test.serial(
`openfn ${jobsPath}/wf-errors.json -S "{ \\"data\\": { \\"number\\": 2 } }"`,
async (t) => {
Expand All @@ -169,8 +148,8 @@ test.serial(
}
);

test.serial(
`openfn ${jobsPath}/wf-errors.json -S "{ \\"data\\": { \\"number\\": 32 } }"`,
test.serial.only(
`openfn ${jobsPath}/wf-errors.json -iS "{ \\"data\\": { \\"number\\": 32 } }"`,
async (t) => {
const { err } = await run(t.title);
t.falsy(err);
Expand All @@ -189,7 +168,7 @@ test.serial(
severity: 'fail',
source: 'runtime',
},
jobId: 'start',
stepId: 'start',
message: 'abort',
type: 'JobError',
},
Expand Down
26 changes: 14 additions & 12 deletions integration-tests/cli/test/fixtures/circular.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"jobs": [
{
"id": "a",
"expression": "x",
"next": { "b": true }
},
{
"id": "b",
"expression": "x",
"next": { "a": true }
}
]
"workflow": {
"steps": [
{
"id": "a",
"expression": "x",
"next": { "b": true }
},
{
"id": "b",
"expression": "x",
"next": { "a": true }
}
]
}
}
13 changes: 8 additions & 5 deletions integration-tests/cli/test/fixtures/invalid-config-path.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"jobs": [
{
"configuration": "does-not-exist.json"
}
]
"workflow": {
"steps": [
{
"configuration": "does-not-exist.json",
"expression": "."
}
]
}
}
12 changes: 7 additions & 5 deletions integration-tests/cli/test/fixtures/invalid-exp-path.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"jobs": [
{
"expression": "does-not-exist.js"
}
]
"workflow": {
"steps": [
{
"expression": "does-not-exist.js"
}
]
}
}
18 changes: 11 additions & 7 deletions integration-tests/cli/test/fixtures/invalid-start.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"start": "nope",
"jobs": [
{
"id": "x",
"expression": "fn((state) => state)"
}
]
"options": {
"start": "nope"
},
"workflow": {
"steps": [
{
"id": "x",
"expression": "fn((state) => state)"
}
]
}
}
12 changes: 7 additions & 5 deletions integration-tests/cli/test/fixtures/invalid-syntax.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"jobs": [
{
"expression": "invalid.js"
}
]
"workflow": {
"steps": [
{
"expression": "invalid.js"
}
]
}
}
34 changes: 18 additions & 16 deletions integration-tests/cli/test/fixtures/multiple-inputs.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"jobs": [
{
"id": "a",
"expression": "x",
"next": { "b": true, "c": true }
},
{
"id": "b",
"expression": "x",
"next": { "c": true }
},
{
"id": "c",
"expression": "x"
}
]
"workflow": {
"steps": [
{
"id": "a",
"expression": "x",
"next": { "b": true, "c": true }
},
{
"id": "b",
"expression": "x",
"next": { "c": true }
},
{
"id": "c",
"expression": "x"
}
]
}
}
19 changes: 19 additions & 0 deletions integration-tests/cli/test/fixtures/plan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"options": {
"start": "b"
},
"workflow": {
"steps": [
{
"id": "a",
"adaptor": "common",
"expression": "fn((state) => { return state; });"
},
{
"id": "b",
"adaptor": "http",
"expression": "get('https://jsonplaceholder.typicode.com/todos/1')"
}
]
}
}
40 changes: 21 additions & 19 deletions integration-tests/cli/test/fixtures/wf-array.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"jobs": [
{
"id": "a",
"adaptor": "common",
"expression": "fn((state) => { if (!state.data.items) { state.data.items = []; } return state; });",
"next": { "b": true }
},
{
"id": "b",
"adaptor": "common",
"expression": "fn((state) => { state.data.items.push('b'); return state; });",
"next": { "c": true }
},
{
"id": "c",
"adaptor": "common",
"expression": "fn((state) => { state.data.items.push('c'); return state; });"
}
]
"workflow": {
"steps": [
{
"id": "a",
"adaptor": "common",
"expression": "fn((state) => { if (!state.data.items) { state.data.items = []; } return state; });",
"next": { "b": true }
},
{
"id": "b",
"adaptor": "common",
"expression": "fn((state) => { state.data.items.push('b'); return state; });",
"next": { "c": true }
},
{
"id": "c",
"adaptor": "common",
"expression": "fn((state) => { state.data.items.push('c'); return state; });"
}
]
}
}
50 changes: 26 additions & 24 deletions integration-tests/cli/test/fixtures/wf-conditional.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{
"start": "start",
"jobs": [
{
"id": "start",
"state": {
"data": {
"number": 1
"options": { "start": "start" },
"workflow": {
"steps": [
{
"id": "start",
"state": {
"data": {
"number": 1
}
},
"adaptor": "common",
"expression": "fn((state) => state);",
"next": {
"small": { "condition": "state.data.number < 10" },
"large": { "condition": "state.data.number >= 10" }
}
},
"adaptor": "common",
"expression": "fn((state) => state);",
"next": {
"small": { "condition": "state.data.number < 10" },
"large": { "condition": "state.data.number >= 10" }
{
"id": "small",
"adaptor": "common",
"expression": "fn((state) => { state.data.result = \"small\"; return state; });"
},
{
"id": "large",
"adaptor": "common",
"expression": "fn((state) => { state.data.result = \"large\"; return state; });"
}
},
{
"id": "small",
"adaptor": "common",
"expression": "fn((state) => { state.data.result = \"small\"; return state; });"
},
{
"id": "large",
"adaptor": "common",
"expression": "fn((state) => { state.data.result = \"large\"; return state; });"
}
]
]
}
}
Loading