-
Notifications
You must be signed in to change notification settings - Fork 19
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
Rename WorkContext to ExeUnit #982
Conversation
Moved unit tests to related directories in src BREAKING CHANGE: The API object WorkContext (ctx) has been renamed to ExeUnit. All references to WorkContext must be updated.
…rdown` method BREAKING CHANGE: The current use of the `WorkContext.before()` method should be replaced with`ExeUnit.setup()`
await Promise.allSettled([ | ||
pool.withLease(async (lease) => | ||
lease | ||
.getExeUnit() | ||
.then((exe) => exe.run(`echo Hello, Golem from the first machine! 👋 ${exe.provider.name}`)) | ||
.then((res) => console.log(res.stdout)), | ||
), | ||
pool.withLease(async (lease) => | ||
lease | ||
.getExeUnit() | ||
.then((exe) => exe.run(`echo Hello, Golem from the second machine! 👋 ${exe.provider.name}`)) | ||
.then((res) => console.log(res.stdout)), | ||
), | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better example would be to show that if you re-use a lease the setup and teardown are only executed once (for example make w pool with concurrency 2 and run 10 tasks on it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or we could borrow the example from TE where we upload a file, add lines to it in every task function and then display the contents at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe... an example with rendering... 🫣 intentionally change the name to rendering.ts
, this is the original example where it is necessary to use the setup
.. (?)
I added it for comparison - rendering.ts
Example for setup and teardown
… into mgordel/JST-984/exe-unit-rename
WorkContext
toExeUnit
OneOf
andManyOfOptions
includingsetup
andteardown
functionBREAKING CHANGE: The API object WorkContext (ctx) has been renamed to ExeUnit. All references to WorkContext must be updated.
BREAKING CHANGE: The current use of the
WorkContext.before()
methodshould be replaced with
ExeUnit.setup()