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

Refactor tasks to not fork, and always run in-process of the main execution pipeline #1613

Merged
merged 31 commits into from
Dec 13, 2022

Conversation

mweichert
Copy link
Collaborator

🌮 Taqueria PR - Targeting prerelease branch.

🪁 Description

We have three groups of tasks:

Global tasks

  • Built-in tasks
  • Tasks that can be executed inside or outside the context of a Taqueria project

Internal tasks

  • Built-in tasks
  • Tasks that may only be executed in the context of a Taqueria project

Plugin-provided tasks

  • Tasks provided by plugins
  • Tasks that may only be executed in the context of a Taqueria project

Before this PR, global tasks and internal tasks would get executed outside of the main execution pipeline (future).

This has created concurrency issues, and been the source for many memory leaks.

🪂 Pre-Merge Checklist (Definition of Done)

🚦 Required to merge:

  • ⛱️ I have completed this PR template in full and updated the title appropriately
  • ⛵ My code builds cleanly, and I have manually tested the changes
  • 🏄‍♂️ Another team member has built this branch and done manual testing on the change
  • 🏖️ New and existing unit tests pass locally and in CI
  • 🔱 The test plan has been implemented and verified by an SDET
  • 🦀 Automated tests have been written and added to this PR
  • 🐬 I have commented my code, particularly in hard-to-understand areas
  • 🤿 Corresponding changes have been made to all documentation
  • 🐚 Required changes to the VScE have been made
  • 🪸 Required updates to scaffolds have been made
  • 🚢 The release checklist has been completed

🛩️ Summary of Changes

This PR adjusts the CLI in such that:

  • Global and Internal tasks are segmented from built-in tasks
  • Global and internal tasks execute within the main pipeline

This results in fewer memory leaks, and resolves some concurrency/timing issues that was blocking other work.

This branch also fixes #309

🎢 Test Plan

I've manually tested each global and internal task.

Michael Weichert added 26 commits December 7, 2022 14:48
… inside the same pipeline as tasks provided by plugins.
@mweichert mweichert requested a review from a team as a code owner December 10, 2022 20:25
@mweichert mweichert requested a review from a team December 10, 2022 20:25
@mweichert mweichert self-assigned this Dec 10, 2022
@mweichert mweichert added the refactor Tasks that involve refactoring existing code label Dec 10, 2022
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 10, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b405eb0
Status: ✅  Deploy successful!
Preview URL: https://137fd0cf.taqueria.pages.dev
Branch Preview URL: https://refactor-internal-tasks.taqueria.pages.dev

View logs

@mweichert mweichert linked an issue Dec 10, 2022 that may be closed by this pull request
7 tasks
@mweichert mweichert changed the title Refactor internal tasks Refactor tasks to not fork, and always run in-process of the main execution pipeline Dec 10, 2022
@mweichert
Copy link
Collaborator Author

Note, I've created an issue for something discovered in this effort of work: #1614

taqueria-plugin-metadata/src/proxy.ts Outdated Show resolved Hide resolved
cli.ts Show resolved Hide resolved
@mweichert mweichert requested a review from jchenche December 12, 2022 22:30
@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2022

Latest Commit b405eb0
Taq Binaries

Linux
MacOS

npm Packages

npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @taqueria/[email protected] --registry https://npm.ecadinfra.com
npm i @0.25.0-1613.b405eb05 --registry https://npm.ecadinfra.com

VSCode Extension VSIX

taqueria-vscode-refactor-internal-tasks-ubuntu-latest

option === OPT_IN
? 'The command "taq opt-in" is ignored as this might be the first time running Taqueria...'
: 'The command "taq opt-out" is ignored as this might be the first time running Taqueria...'
mapRej(previous =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need it? I thought this would not be needed after the internal task refactor

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to be honest. If not, I assume we'll address that in a different ticket/PR.
The acceptance criteria for this particular issue/PR was:

Refactor remaining internal tasks so that the execution flow matches that of plugin-provided tasks

As that criteria is a little vague, I interpreted it to be:

Refactor tasks to not fork but run in the main execution pipeline

The motive for that , as far as I was aware, was to resolve a) memory leaks; b) concurrency issues; c) make the code easier to reason about; d) ability to ask for --help for built-in tasks

I had thought that the only thing holding back GA tracking was issue B above.

--
I modified the following code strictly for type correctness, as this section of code was returning Future<string, unknown> instead of Future<TaqError, unknown>:

Before:

mapRej(() =>
  option === OPT_IN
	  ? 'The command "taq opt-in" is ignored as this might be the first time running Taqueria...'
	  : 'The command "taq opt-out" is ignored as this might be the first time running Taqueria...'
)

After:

mapRej(previous => TaqError.create({
	kind: 'E_OPT_IN_WARNING',
	msg: option === OPT_IN
		? 'The command "taq opt-in" is ignored as this might be the first time running Taqueria...'
		: 'The command "taq opt-out" is ignored as this might be the first time running Taqueria...',
	previous,
	context: option,
})

If the above code isn't needed anymore, great - but I'd probably prefer making that adjustment in a different PR, as I cannot recall the reason why Jimmy added this code, and too, I think that's outside of the scope I had in mind in this PR. Would you be fine if we created an issue for this instead, Ali? I would do so, but given that you recognized this, I assume you might have more context/recollection about why this code was here to start with.

@danielelisi
Copy link
Contributor

Is the prerelease-0.25.0 branch up to date with main ? I see unrelated changes to GH workflow files in this PR

@mweichert
Copy link
Collaborator Author

mweichert commented Dec 12, 2022

Is the prerelease-0.25.0 branch up to date with main ? I see unrelated changes to GH workflow files in this PR

@danielelisi Main was merged into this branch 2 days ago: c1d4a33

Feel free to modify this branch directly if something looks off with regards to the workflow stuff.

@mweichert mweichert merged commit 61d1ca0 into prerelease-0.25.0 Dec 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
refactor Tasks that involve refactoring existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚧 Dev ➾ Refactor Internal Tasks to Run Like Plugin Tasks
5 participants