-
Notifications
You must be signed in to change notification settings - Fork 623
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(cli): add queues, workers and worker-groups commands #4439
Conversation
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.
👍 Looks good to me! Reviewed everything up to aeb3cf3 in 1 minute and 27 seconds
More details
- Looked at
1648
lines of code in23
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. backend/src/monitor.rs:1075
- Draft comment:
Thesave_metrics
logic defaults totrue
iflast_check
isNone
, which might lead to unnecessary metric saving. Consider handling theNone
case more explicitly or initializinglast_check
with a more appropriate default. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment points out a potential inefficiency in the logic that defaultssave_metrics
totrue
whenlast_check
isNone
. This could indeed lead to unnecessary operations if the intention was to avoid saving metrics in such cases. The comment is relevant to the changes made in the diff and suggests a possible improvement.
The comment assumes that saving metrics whenlast_check
isNone
is unnecessary, but without more context, it's unclear if this behavior is actually problematic. The current logic might be intentional to ensure metrics are saved at least once if no previous check exists.
The logic of defaulting totrue
whenlast_check
isNone
could be intentional, but the comment raises a valid point about potential inefficiency. It's worth considering if this behavior aligns with the intended functionality.
The comment is valid as it highlights a potential inefficiency in the logic that defaultssave_metrics
totrue
whenlast_check
isNone
. It is relevant to the changes made in the diff and suggests a possible improvement.
2. backend/windmill-api/src/configs.rs:47
- Draft comment:
Consider optimizing the removal of the 'worker__' prefix from config names by handling it at the point of data retrieval or in a single pass to improve efficiency. - Reason this comment was not posted:
Confidence changes required:50%
Inbackend/windmill-api/src/configs.rs
, thelist_worker_groups
function modifies thename
field ofConfig
by removing the 'worker__' prefix. This is done in a loop, which is fine, but it would be more efficient to handle this transformation in a single pass or at the point of data retrieval if possible. This would reduce the need for iterating over the data multiple times.
3. backend/windmill-api/src/jobs.rs:5106
- Draft comment:
Consider using an integer type forhorizon_secs
in the SQL query instead ofFloat8
to avoid unnecessary type conversion. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment seems to address a potential inefficiency in the code by suggesting a type change to avoid unnecessary conversion. The SQL functionmake_interval
might indeed expect an integer, and usingf64
could be unnecessary. The comment is actionable and suggests a clear code improvement.
I might be missing the exact requirements of themake_interval
function and whether it strictly requires an integer. The current implementation might work as intended, and the conversion tof64
might not cause any issues.
The suggestion to use an integer type seems reasonable and could improve code efficiency by avoiding unnecessary type conversion. It's worth considering this change if it aligns with the SQL function's requirements.
Keep the comment as it suggests a clear and actionable improvement to the code by recommending a type change to avoid unnecessary conversion.
4. backend/windmill-api/src/workers.rs:92
- Draft comment:
Ensure thatoccupancy_rate_5m
andoccupancy_rate_30m
fields are correctly populated in the database to avoid runtime errors when fetching worker pings. - Reason this comment was not posted:
Confidence changes required:50%
Inbackend/windmill-api/src/workers.rs
, thelist_worker_pings
function fetches data from theworker_ping
table. The query includesoccupancy_rate_5m
andoccupancy_rate_30m
, which are new fields. Ensure that these fields are correctly populated in the database to avoid runtime errors.
Workflow ID: wflow_rRYxmVsJVe0iJMgy
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
❌ Changes requested. Incremental review on e24dc6a in 41 seconds
More details
- Looked at
114
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_p9JjFKvtFH7ghuTN
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
cli/workers.ts
Outdated
} else { | ||
|
||
new Table() | ||
.header(["Worker ID", "Host", "Queues", "Jobs", "Occupancy rate 5m/30m/ever)", "Last job", "Last Ping"]) |
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.
The header 'Occupancy rate 5m/30m/ever)' has a misplaced closing parenthesis. It should be 'Occupancy rate (5m/30m/ever)'.
.header(["Worker ID", "Host", "Queues", "Jobs", "Occupancy rate 5m/30m/ever)", "Last job", "Last Ping"]) | |
.header(["Worker ID", "Host", "Queues", "Jobs", "Occupancy rate (5m/30m/ever)", "Last job", "Last Ping"]) |
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.
👍 Looks good to me! Incremental review on 0c7e73b in 28 seconds
More details
- Looked at
950
lines of code in34
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. backend/windmill-worker/src/worker.rs:1374
- Draft comment:
The functionupdate_occupancy_metrics
is correctly refactored to encapsulate the logic for updating occupancy metrics. This improves code readability and maintainability by separating concerns. - Reason this comment was not posted:
Confidence changes required:0%
The functionupdate_occupancy_metrics
is defined incommon.rs
and used inworker.rs
. The function is correctly refactored to encapsulate the logic for updating occupancy metrics. This refactoring improves code readability and maintainability by separating concerns. The function is used inrun_worker
to update the worker's occupancy metrics, which is consistent with its intended purpose. The refactoring does not introduce any logical errors or performance issues.
Workflow ID: wflow_ljZVvuYbDSZQIomI
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on d94b803 in 27 seconds
More details
- Looked at
810
lines of code in32
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. backend/src/ee.rs:7
- Draft comment:
Consider using a custom error type to indicate that this feature is not available in the community edition. This would make error handling more consistent and informative. - Reason this comment was not posted:
Confidence changes required:50%
The code inbackend/src/ee.rs
andbackend/windmill-api/src/ee.rs
usesanyhow::anyhow!
for error handling, which is fine for general errors. However, in the context of enterprise features, it might be more appropriate to use a custom error type that clearly indicates the feature is not available in the community edition. This would make error handling more consistent and informative.
2. backend/windmill-api/src/ee.rs:9
- Draft comment:
Consider using a custom error type to indicate that this feature is not available in the community edition. This would make error handling more consistent and informative. - Reason this comment was not posted:
Confidence changes required:50%
The code inbackend/src/ee.rs
andbackend/windmill-api/src/ee.rs
usesanyhow::anyhow!
for error handling, which is fine for general errors. However, in the context of enterprise features, it might be more appropriate to use a custom error type that clearly indicates the feature is not available in the community edition. This would make error handling more consistent and informative.
Workflow ID: wflow_eZ02RZqRBBrpdMTY
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on 2815221 in 54 seconds
More details
- Looked at
1148
lines of code in14
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. backend/windmill-worker/src/deno_executor.rs:8
- Draft comment:
Thehandle_child
function is imported fromhandle_child
module here. Ensure consistent import paths across the codebase for better maintainability. - Reason this comment was not posted:
Confidence changes required:50%
Thehandle_child
function is used in multiple files, but the import path is inconsistent. It should be imported fromhandle_child
module consistently.
2. backend/windmill-worker/src/graphql_executor.rs:15
- Draft comment:
Therun_future_with_polling_update_job_poller
function is imported fromhandle_child
module here. Ensure consistent import paths across the codebase for better maintainability. - Reason this comment was not posted:
Confidence changes required:50%
Therun_future_with_polling_update_job_poller
function is used in multiple files, but the import path is inconsistent. It should be imported fromhandle_child
module consistently.
3. backend/windmill-worker/src/js_eval.rs:43
- Draft comment:
Therun_future_with_polling_update_job_poller
function is imported fromhandle_child
module here. Ensure consistent import paths across the codebase for better maintainability. - Reason this comment was not posted:
Confidence changes required:50%
Therun_future_with_polling_update_job_poller
function is used in multiple files, but the import path is inconsistent. It should be imported fromhandle_child
module consistently.
4. backend/windmill-worker/src/mssql_executor.rs:19
- Draft comment:
Therun_future_with_polling_update_job_poller
function is imported fromhandle_child
module here. Ensure consistent import paths across the codebase for better maintainability. - Reason this comment was not posted:
Confidence changes required:50%
Therun_future_with_polling_update_job_poller
function is used in multiple files, but the import path is inconsistent. It should be imported fromhandle_child
module consistently.
Workflow ID: wflow_kWakeWJEKwfElFUA
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on d96b4ab in 53 seconds
More details
- Looked at
957
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. backend/windmill-worker/src/handle_child.rs:577
- Draft comment:
Usingunwrap
here can cause a panic if the child process does not have a handle to stdout. Consider handling this case more gracefully, perhaps by returning a Result or usingexpect
with a clear error message. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. backend/windmill-worker/src/handle_child.rs:582
- Draft comment:
Usingunwrap
here can cause a panic if the child process does not have a handle to stderr. Consider handling this case more gracefully, perhaps by returning a Result or usingexpect
with a clear error message. - Reason this comment was not posted:
Comment looked like it was already resolved.
3. backend/windmill-worker/src/handle_child.rs:595
- Draft comment:
Usingunwrap_or(0)
here can lead to unexpected behavior ifpoll_next_line
fails. Consider handling this case explicitly to avoid potential issues. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment points out a potential issue with error handling in thelines_to_stream
function. The use ofunwrap_or(0)
could indeed mask errors, leading to unexpected behavior. This is a valid concern as it relates to error handling, which is crucial in robust software development.
The comment assumes that the error handling is inadequate without considering the context in whichlines_to_stream
is used. It's possible that the surrounding code handles errors appropriately, making this comment less relevant.
Even if the surrounding code handles errors, it's generally good practice to handle errors explicitly where they occur to avoid unexpected behavior. The comment highlights a potential improvement in error handling.
The comment raises a valid point about error handling in thelines_to_stream
function. It suggests an improvement that could prevent unexpected behavior, making it a useful comment to keep.
4. backend/windmill-worker/src/job_logger.rs:322
- Draft comment:
Usingunwrap_or(0)
here can lead to unexpected behavior if thechar_indices
iterator is empty. Consider handling this case explicitly to avoid potential issues. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The use ofunwrap_or(0)
is a common pattern to provide a default value when an option isNone
. In this context, it seems to be used to handle the case where the iterator is empty, which is a valid use case. The comment suggests that this might lead to unexpected behavior, but without specific evidence of an issue, it seems speculative.
The comment might be pointing out a potential edge case that could lead to a bug, but without specific evidence or examples, it's hard to determine if it's a real issue.
While the comment is speculative, it does raise a valid point about potential edge cases. However, without concrete evidence of an issue, it might not be necessary to address it immediately.
The comment is speculative and does not provide strong evidence of an issue. It should be removed unless there is a clear indication of a problem.
Workflow ID: wflow_sOFVao50a6lKMioH
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on eeefdf5 in 52 seconds
More details
- Looked at
2167
lines of code in30
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. cli/workers.ts:69
- Draft comment:
There's an extra parenthesis in the header text for occupancy rate. It should be removed for consistency.
.header(["Worker ID", "Host", "Queues", "Jobs", "Occupancy rate 15s/5m/30m/ever", "Last job", "Last Ping"])
- Reason this comment was not posted:
Confidence changes required:50%
The code incli/workers.ts
andfrontend/src/routes/(root)/(logged)/workers/+page.svelte
is related to displaying worker information, including occupancy rates. The occupancy rate is displayed in both the CLI and frontend, and the format is consistent. However, there is a minor inconsistency in the header text for occupancy rate in the CLI output, which includes an extra parenthesis. This should be corrected for consistency and clarity.
Workflow ID: wflow_bXYXsRZRWrUYy9Z3
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Add CLI commands for managing queues, workers, and worker groups with corresponding backend and frontend support.
queues
,workers
, andworker-groups
commands incli/main.ts
.displayQueues
incli/queues.ts
to list queue metrics.displayWorkers
incli/workers.ts
to list workers by group.displayWorkerGroups
incli/worker_groups.ts
to manage worker group configs./jobs/completed/count_by_tag
inopenapi.yaml
for job count by tag.worker_ping
table withoccupancy_rate_5m
andoccupancy_rate_30m
inmigrations/20240924213010_add_last_occupancy_rates.up.sql
.list_worker_pings
inworkers.rs
to include new occupancy rates.+page.svelte
to display worker groups and metrics..sqlx
files for metrics and worker updates.instance.ts
to handle new CLI commands and options.This description was created by
for eeefdf5. It will automatically update as commits are pushed.