Skip to content

Commit

Permalink
Runtime: remove the default timeout (#691)
Browse files Browse the repository at this point in the history
* remove runtime's own timeout and replace with defaultRunTimeoutMs

* runtime: typing

* versions: [email protected] [email protected]
  • Loading branch information
josephjclark authored May 13, 2024
1 parent 76165eb commit 472e0ec
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 11 deletions.
8 changes: 8 additions & 0 deletions integration-tests/worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/integration-tests-worker

## 1.0.43

### Patch Changes

- @openfn/engine-multi@1.1.7
- @openfn/lightning-mock@2.0.7
- @openfn/ws-worker@1.1.8

## 1.0.42

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openfn/integration-tests-worker",
"private": true,
"version": "1.0.42",
"version": "1.0.43",
"description": "Lightning WOrker integration tests",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/cli

## 1.2.5

### Patch Changes

- Default the run timeout
- Updated dependencies
- @openfn/runtime@1.1.3

## 1.2.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.2.4",
"version": "1.2.5",
"description": "CLI devtools for the openfn toolchain.",
"engines": {
"node": ">=18",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/execute/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default async (
}
},
},
defaultRunTimeoutMs: 5 * 60 * 1000, // 5 minutes
});
return result;
} catch (e: any) {
Expand Down
7 changes: 7 additions & 0 deletions packages/engine-multi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# engine-multi

## 1.1.7

### Patch Changes

- Updated dependencies
- @openfn/runtime@1.1.3

## 1.1.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-multi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/engine-multi",
"version": "1.1.6",
"version": "1.1.7",
"description": "Multi-process runtime engine",
"main": "dist/index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-multi/src/worker/thread/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ register({

// TODO I would like to pull these options out of here
const options = {
// disable the run/step timeout
// disable the runtime's own timeout
timeout: 0,
strict: false,
logger,
Expand Down
8 changes: 8 additions & 0 deletions packages/lightning-mock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/lightning-mock

## 2.0.7

### Patch Changes

- Updated dependencies
- @openfn/runtime@1.1.3
- @openfn/engine-multi@1.1.7

## 2.0.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/lightning-mock/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/lightning-mock",
"version": "2.0.6",
"version": "2.0.7",
"private": true,
"description": "A mock Lightning server",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/runtime

## 1.1.3

### Patch Changes

- Don't default the run timeout

## 1.1.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/runtime",
"version": "1.1.2",
"version": "1.1.3",
"description": "Job processing runtime.",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/src/execute/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import stringify from 'fast-safe-stringify';
import type { Operation, State } from '@openfn/lexicon';

import loadModule from '../modules/module-loader';
import { Options, DEFAULT_TIMEOUT_MS } from '../runtime';
import { Options } from '../runtime';
import buildContext, { Context } from './context';
import defaultExecute from '../util/execute';
import clone from '../util/clone';
Expand Down Expand Up @@ -38,7 +38,7 @@ export default (
let duration = Date.now();
const { logger, plan, opts = {} } = ctx;
try {
const timeout = plan.options?.timeout ?? DEFAULT_TIMEOUT_MS;
const timeout = plan.options?.timeout ?? ctx.opts.defaultRunTimeoutMs;

// Setup an execution context
const context = buildContext(input, opts);
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type { LinkerOptions } from './modules/linker';
import executePlan from './execute/plan';
import { defaultState, parseRegex, clone } from './util/index';

export const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes

export type Options = {
logger?: Logger;
jobLogger?: Logger;
Expand All @@ -28,6 +26,8 @@ export type Options = {
globals?: any;

statePropsToRemove?: string[];

defaultRunTimeoutMs?: number;
};

type RawOptions = Omit<Options, 'linker'> & {
Expand Down
8 changes: 8 additions & 0 deletions packages/ws-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ws-worker

## 1.1.8

### Patch Changes

- Updated dependencies
- @openfn/runtime@1.1.3
- @openfn/engine-multi@1.1.7

## 1.1.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/ws-worker",
"version": "1.1.7",
"version": "1.1.8",
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
"main": "dist/index.js",
"type": "module",
Expand Down

0 comments on commit 472e0ec

Please sign in to comment.