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

feat(core): introduce continuous tasks #29750

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Jan 24, 2025

Summary

An RFC about this feature is happening here: #29025. This has the most information about this feature.

Current Behavior

Nx currently does not explicitly handle tasks which run continuously until they are terminated.

Expected Behavior

This PR adds the initial support for continuous tasks which run continuously until they are terminated. This adds the ability to depend on continuous tasks. There is some more work to be done but this will be enough as an MVP.

Related Issue(s)

Fixes #

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Feb 4, 2025 9:59pm

@FrozenPandaz FrozenPandaz changed the title Continuous tasks WIP: Continuous Tasks Jan 24, 2025
Copy link

nx-cloud bot commented Jan 24, 2025

View your CI Pipeline Execution ↗ for commit a137998.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 41m 18s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check --base= --he... ✅ Succeeded 7s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 4s View ↗
nx documentation ✅ Succeeded 1m 19s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-04 22:38:44 UTC

Copy link

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx [email protected] my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-29750-cc9549c
Release details 📑
Published version 0.0.0-pr-29750-cc9549c
Triggered by @FrozenPandaz
Branch continuous-tasks
Commit cc9549c
Workflow run 13014531551

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

!shouldPrefix
) {
// todo implement this
// return await this.runTaskInForkedProcess(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing this

@@ -725,4 +767,87 @@ export class TaskOrchestrator {
}

// endregion utils
private async startInfiniteTask(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Change this to continuous

packages/nx/src/tasks-runner/utils.ts Show resolved Hide resolved
@@ -135,18 +135,37 @@ export class PseudoTerminal {
}
}

let i = 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remove this

@@ -30,19 +31,37 @@ describe('PseudoTerminal', () => {
}, 1000);

it('should subscribe to output', (done) => {
const childProcess = terminal.runCommand('echo "hello world"');
const childProcess = terminal.runCommand('sleep 1 && echo "hello world"');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remove this

@FrozenPandaz FrozenPandaz changed the title WIP: Continuous Tasks feat(core): introduce continuous tasks Feb 3, 2025
@FrozenPandaz FrozenPandaz marked this pull request as ready for review February 3, 2025 23:59
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner February 3, 2025 23:59
}

async function createProcessWithPseudoTty(
pseudoTerminal: PseudoTerminal | null,
Copy link
Member

Choose a reason for hiding this comment

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

remove null

Comment on lines 185 to 188
} finally {
if (this.isAlive == true) {
this.isAlive = false;
}
Copy link
Member

Choose a reason for hiding this comment

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

This can probably be simplified to just this since we check if its alive above:

Suggested change
} finally {
if (this.isAlive == true) {
this.isAlive = false;
}
} finally {
this.isAlive = false;

@FrozenPandaz FrozenPandaz merged commit 13b513b into next-major Feb 4, 2025
12 checks passed
@FrozenPandaz FrozenPandaz deleted the continuous-tasks branch February 4, 2025 23:02
FrozenPandaz added a commit that referenced this pull request Feb 4, 2025
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Summary

An RFC about this feature is happening here: #29025. This has the most
information about this feature.

## Current Behavior
<!-- This is the behavior we have today -->

Nx currently does not explicitly handle tasks which run continuously
until they are terminated.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

This PR adds the initial support for continuous tasks which run
continuously until they are terminated. This adds the ability to depend
on continuous tasks. There is some more work to be done but this will be
enough as an MVP.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
FrozenPandaz added a commit that referenced this pull request Feb 5, 2025
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Summary

An RFC about this feature is happening here: #29025. This has the most
information about this feature.

## Current Behavior
<!-- This is the behavior we have today -->

Nx currently does not explicitly handle tasks which run continuously
until they are terminated.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

This PR adds the initial support for continuous tasks which run
continuously until they are terminated. This adds the ability to depend
on continuous tasks. There is some more work to be done but this will be
enough as an MVP.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants