Commit Graph

3919 Commits

Author SHA1 Message Date
Eric Allam b1b9321ad2 Job run performance improvements and adding "worker only" mode (#360)
* WIP job run performance improvements

- Added a `perf` tool to better measure job run performance under heavy load
- Removed `runFinished` job (not really needed)
- startQueuedRuns now uses a jobKey with replace
- Fixed an issue with ZodWorker when using jobKey

* Publish improvement docker images

* fixed the improvement docker publishing

* Downgrade back to prisma 4.16.0 because 5.1.x broke docker builds

* Changes to how queued runs work

- Split the worker into two different workers, one dedicated to performRunExecution
- Schedule performRunExecution in a single place, with a queue and using a round robin manually controlled concurrency
- Remove startQueuedRuns
- All runs are queued before they are started
- Setting the worker maxPoolSize to the same as the worker concurrency
- Starting to be able to split the docker image

* Remove queue name from startRun graphile job

* Make the prisma connection pool stuff configurable through env vars

* Hardcode (for now) the max concurrent runs limit

* Rewrite performRunExecution to be more performant

PerformRunExecutionV2:

- Does not create and manage jobRunExecution records
- Does not reimplement retrying, uses graphile worker retrying instead

I’ve kept around PerformRunExecutionV1 so this works when deploying. Definitely needs LOTS of testing

* Fix issues with cached tasks

- Limit the size of the cached tasks sent when executing a run, using the knapsack problem dynamic programming approach
- Actually USE the cached tasks in IO by using the idempotencyKey instead of the task ID
- Remove output from all logs
- Added a stress test job catalog

* Forgot to commit the logger updates

* Never log connectionString

* Login to docker hub to get around rate limits

* Add additional logging to the graphile workers

* Fix the *_ENABLED  env vars

* Allow adding and removing jobs to be done from the webapp

* Don’t set the job to failed if it’s being retried

* Deprecated queue options in the job and removed startPosition. Now using the job/env combo as the job queue name

* Dequeung jobs doesn’t check if the runner is initialized

* Fixed issues with retrying a run getting stuck on a cancelled task, and errors from parsing the results of dequeing a job

* Remove queued round robin thing that isn’t used anymore

* Added slack to job catalog

* Better forwards compat

* Added long delay

* Fixed lock file
2023-08-18 15:25:26 +01:00
Dan a69f756e34 Added delay example to init.ts so it works with the pages router (#363) 2023-08-18 15:22:18 +01:00
Chigala 18a02829e3 set the jobkey as event:event.id 2023-08-18 15:21:09 +01:00
Matt Aitken 0f6e580641 Added SendGrid to the integrations table in docs 2023-08-18 15:13:16 +01:00
Chigala 796f1209f2 Docs/sendgrid doc (#359)
* added sengrid integration to the catalog

* added documention for sendgrid integration

* updated the mint.json file
2023-08-18 15:09:04 +01:00
Liran Tal 4ce96b7d28 fix: avoid code duplication by repostioning the default switch case (#356) 2023-08-18 14:48:07 +01:00
Wesley b86ffa0d3d test/add test on get user pkg manager (#349)
* chore: make possible to write tests aside with implementations

* test: write getUserPkgManager test TO-DOs

* test: add test to building the path

* test: add tests to manual file checking

* test: add tests to npm_config_user_agent

* Update packages/cli/src/utils/getUserPkgManager.spec.ts
2023-08-18 14:43:19 +01:00
Wesley 3ee7cd6ff6 feat: parse callback result with zod before return (#342) 2023-08-18 14:33:42 +01:00
Wesley 74686c00cb feature/TRI 712/create eslint plugin to ensure uniqueness on task keys (#324)
* test: add test to no-duplicated-task-keys rule

* feat: implement no-duplicated-task-keys

* chore: create testing scripts

* refactor: fill in rule meta

* feat: export no-duplicated-task-keys rule

* chore: bump package version to 0.0.1

* chore: create eslint plugin

* feat: create no-duplicated-task-keys rule

* refactor: delete no-duplicated-task-keys from config-custom

* refactor: rename eslint-plugin folder

* feat: cover case from nextjs-example

* feat: cover additional cases from examples/package-tester

* chore: add eslint-plugin on nextjs-example

* feat: add more cases from `nextjs-example`

* revert: rollback changes on eslint-config-custom

* Set version to 2.0.9, inline with other packages

* Create chilly-pianos-try.md

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-18 12:57:12 +01:00
Liran Tal 8f3e550d03 fix: small typo in function docblocks (#362) 2023-08-18 12:17:45 +01:00
Matt Aitken 65cff19ead Merge branch 'main' into main 2023-08-18 11:20:44 +01:00
Matt Aitken 591422b8cf CLI: added whoami command, fixed TypeScript error 2023-08-18 11:18:51 +01:00
neo773 bbaa6ba156 [TRI-1006] New @trigger.dev/cli whoami command. (#316)
* FIx: [TRI-1006] New @trigger.dev/cli whoami command.

* revert dev.ts zod schema to original

* Removed telemetry

* remove all telemetry

* Made the clientId optional again

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-18 10:41:06 +01:00
Liran Tal e20fa3c2ec fix: explicitly set a charset for rendered HTML documents (#355) 2023-08-18 06:49:39 +01:00
Liran Tal 57514f8771 fix: code quality nitpicks for some issues spotted (#357) 2023-08-18 06:48:48 +01:00
Chigala ef1a1ff343 added io.cancelEvent support and fixed other requested changes 2023-08-18 06:21:57 +01:00
Rishi Raj Jain 2fbaa30b9f Update index.ts 2023-08-17 23:45:44 +05:30
Rishi Raj Jain 1199e934c2 Merge branch 'main' into main 2023-08-17 23:45:12 +05:30
Wesley 83bcefe10c refactor: remove .js extension from cli package (#350)
* refactor: remove `.js` extension from cli package

* revert: rollback changes

* revert: rollback unnecessary changes

* Update createIntegration.ts

---------

Co-authored-by: Eric Allam <eallam@icloud.com>
2023-08-17 16:03:00 +01:00
Wesley 4ca9f182d7 test/TRI 887/setup jest on cli package (#326)
* chore: run `pnpm install --prefer-frozen-lockfile`

* chore: install `jest` and `ts-jest`

* test: create `jest.config.js`

* chore: install `@types/jest`

* chore: add `jest` on `tsconfig.json` `types` property

* chore: create test script

* test: create example test 🎉🎊🕺🏼

* chore: install `@gmrchk/cli-testing-library`

* chore: override `tsconfig` with `@trigger.dev/tsconfig`

* test: make poc of cli test

* chore: run build before test

* docs: improve comment

* Added a changeset

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-16 22:35:23 +01:00
Matt Aitken 5dec3ed4e6 Latest lockfile @trigger.dev/cli@2.0.9 @trigger.dev/core@2.0.9 @trigger.dev/express@2.0.9 @trigger.dev/github@2.0.9 @trigger.dev/integration-kit@2.0.9 @trigger.dev/nextjs@2.0.9 @trigger.dev/plain@2.0.9 @trigger.dev/react@2.0.9 @trigger.dev/resend@2.0.9 @trigger.dev/sdk@2.0.9 @trigger.dev/sendgrid@2.0.9 @trigger.dev/slack@2.0.9 @trigger.dev/stripe@2.0.9 @trigger.dev/supabase@2.0.9 @trigger.dev/typeform@2.0.9 @trigger.dev/openai@2.0.9 2023-08-16 15:56:30 +01:00
github-actions[bot] 955961eb5f chore: Update version for release (#329)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-16 15:53:53 +01:00
Matt Aitken 33184a8130 Add subtasks to the schema/types when getting an individual run (#343)
* Add subtasks to the schema/types when getting an individual run

* Added a changeset
2023-08-16 15:49:08 +01:00
Eric Allam 5611768854 Improve the job reference 2023-08-15 10:20:30 +01:00
Chigala a3278cb8a2 bug fixes 2023-08-15 00:16:38 +01:00
Eric Allam d0e6442872 Add additional sendEvent exampels 2023-08-14 22:04:40 +01:00
Rishi Raj Jain 05b5ed6973 Update update.ts 2023-08-14 21:42:08 +05:30
Rishi Raj Jain 859425f093 Update update.ts 2023-08-14 21:32:55 +05:30
Matt Aitken 1e374d30d0 Latest lockfile… 2023-08-14 16:54:40 +01:00
Matt Aitken 9f649d2a27 Lock prisma to 5.1.1 2023-08-14 16:52:30 +01:00
Chigala 0a20b6e05a chore: updated prisma from version 4.16.0 to 5.1.0 (#254)
* chore: update prisma from version 4.16.0 to 5.1.0

* fixed the ts-errors due to the prisma update

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-14 16:36:40 +01:00
Eric Allam 78e2d0e9f9 Fix SSE causing app crashes when inner async loop takes too long
🚀 Publish Trigger.dev Docker / ʦ TypeScript (push) Has been cancelled
🚀 Publish Trigger.dev Docker / Unit Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / e2e Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / publish (push) Has been cancelled
v.docker.2.0.0-beta.27
2023-08-14 16:21:45 +01:00
Chigala 24c8f08267 feat: added the ability to cancel Events based on the event ID 2023-08-14 14:56:48 +01:00
Eric Allam 12de1b0d34 Update docs to reference @trigger.dev/react@latest instead of @next 2023-08-14 13:46:58 +01:00
Eric Allam b62df731fc Fixed the example Job trigger file import path when using Pages Router with no path alias 2023-08-14 13:40:59 +01:00
Liran Tal e347389b64 docs: Update integrations.mdx (#328)
* Update integrations.mdx

The first sentence in this paragraph for `### API Keys and Tokens` was missing a word or two and it wasn't entirely clear what did the original author of this docs page intended.

I've entered what seems to be the missing context but happy to re-phrase too if another wording makes better sense here.

* Made it clear that API keys are provided by you in your code

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-14 13:24:31 +01:00
Liran Tal 10f92a6124 docs: Update runs.mdx (#327)
* docs: Update runs.mdx

From what I can tell, it is expected for run functions to return with some sort of payload. Providing an example here as a reference and guideline.

* Made it clear returning data is optional and added some more detail below

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-14 13:22:14 +01:00
Eric Allam b957aa1752 Remove deprecated invitation-code route 2023-08-14 09:41:05 +01:00
Rishi Raj Jain 3159619852 revert pnpm changes 2023-08-12 11:28:27 +05:30
Rishi Raj Jain 300c102b31 remvoe axios and use node-fetch 2023-08-12 11:26:08 +05:30
Rishi Raj Jain 9e0b152c0e Update package.json 2023-08-12 11:19:18 +05:30
Arshad Jamal a998d6c505 Corrected clone link for Windows (#319) 2023-08-12 06:23:45 +01:00
Rishi Raj Jain 4e78da319c Create swift-eagles-float.md 2023-08-11 23:54:06 +05:30
Rishi Raj Jain 2c37091b08 complete the script 2023-08-11 23:48:37 +05:30
James Ritchie 5f739ee312 Removed ts-ignore and added types 2023-08-11 16:11:27 +01:00
James Ritchie fccba7db98 Upgraded the confetti to fireworks 2023-08-11 16:09:47 +01:00
Eric Allam 0f7b7ff6d6 Fix pnpm lock
🚀 Publish Trigger.dev Docker / ʦ TypeScript (push) Has been cancelled
🚀 Publish Trigger.dev Docker / Unit Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / e2e Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / publish (push) Has been cancelled
@trigger.dev/cli@2.0.8 @trigger.dev/core@2.0.8 @trigger.dev/github@2.0.8 @trigger.dev/integration-kit@2.0.8 @trigger.dev/nextjs@2.0.8 @trigger.dev/plain@2.0.8 @trigger.dev/react@2.0.8 @trigger.dev/resend@2.0.8 @trigger.dev/sdk@2.0.8 @trigger.dev/sendgrid@2.0.8 @trigger.dev/slack@2.0.8 @trigger.dev/typeform@2.0.8 v.docker.2.0.0-beta.26 @trigger.dev/stripe@2.0.8 @trigger.dev/openai@2.0.8 @trigger.dev/express@2.0.8 @trigger.dev/supabase@2.0.8
2023-08-11 15:52:52 +01:00
nicktrn 603ffbc426 docs: add supabase guide (#297)
* docs: add supabase guide

* feat: add support for external connection poolers

* chore: use .env symlink in database package

* chore: remove database .env.example

* docs: finish supabase pooling section

* docs: fix small typo

* docs: replace prisma with app wording

* docs: fix up supabase pooling section

* fix: deleted too much in contributing docs

* docs: change pooling heading

* docs: reduce linux shaming

* docs: include direct connection url in fly.io
2023-08-11 15:51:54 +01:00
github-actions[bot] beef7769c6 chore: Update version for release (#304)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-11 15:48:41 +01:00
Eric Allam e9088cf08c Supabase quickstart guide (#311)
* Added docs images for supabase

* Compressed some existing images

* Improved some of the main quickstart wording

* First draft of the Supabase quickstart

* Tweaks to the Supabase quickstart and the supabase integration docs

---------

Co-authored-by: James Ritchie <james@jamesritchie.co.uk>
2023-08-11 15:29:53 +01:00