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: Workflow refactoring, only async #2878

Open
wants to merge 75 commits into
base: main
Choose a base branch
from

Conversation

Matvey-Kuk
Copy link
Contributor

@Matvey-Kuk Matvey-Kuk commented Dec 22, 2024

The prev refactoring got huge, so slicing it to step-by-step PR's.

This one is only about moving Workflows from threads to async.
The next:

  1. Reduce DB footprint.

Closes #2898

Copy link

vercel bot commented Dec 22, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
keep ⬜️ Ignored (Inspect) Visit Preview Dec 30, 2024 0:37am

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Feature A new feature labels Dec 22, 2024
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Dec 22, 2024
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Dec 24, 2024
Copy link

gitguardian bot commented Dec 24, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
8134198 Triggered Generic High Entropy Secret fafba1a keep-ui/app/frigade-provider.tsx View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@keephq keephq deleted a comment from codecov bot Dec 25, 2024
@@ -95,7 +95,7 @@ jobs:
LOG_LEVEL: DEBUG
SQLALCHEMY_WARN_20: 1
run: |
poetry run coverage run --branch -m pytest --timeout 20 -n auto --non-integration --ignore=tests/e2e_tests/
poetry run coverage run --branch -m pytest -n auto --non-integration --ignore=tests/e2e_tests/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving timeout to the pyproject.toml

columns = results.column_names

# Making the results more human readable and compatible with the format we had with sync library before.
results = [dict(zip(columns, row)) for row in rows]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bit of a magic here to make the format of returned data equal to the format used by TCP clickhouse provider.

)
thread.start()
self.threads.append(thread)
await asyncio.create_task(self._run_workflow(tenant_id, workflow_id, workflow, workflow_execution_id))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not the most optimal way of doing it, will fix on the next iteration.

thread.start()
self.threads.append(thread)
tasks.append(asyncio.create_task(self._run_workflow(tenant_id, workflow_id, workflow, workflow_execution_id, event)))
await asyncio.gather(*tasks)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, not optimal to await for them here, but that's for the next iteration. For now, want to keep the code simple.

time.sleep(0.1)
yield manager
manager.stop()
yield manager
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intentionally don't start it here cause better to control it within test

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A new feature size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[👨🏻‍💻 Internal]: Workflow refactoring, only async
2 participants