Skip to content

NAS-135049 / 25.10 / Support new-style jobs #30

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

Merged
merged 3 commits into from
Apr 8, 2025
Merged

Conversation

themylogin
Copy link
Contributor

No description provided.

@themylogin themylogin requested a review from a team March 27, 2025 15:00
@bugclerk bugclerk changed the title Support new-style jobs NAS-135049 / 25.10 / Support new-style jobs Mar 27, 2025
@bugclerk
Copy link

@themylogin themylogin force-pushed the NAS-135049 branch 7 times, most recently from a7f9bde to 3951ee1 Compare April 1, 2025 16:26
Copy link

@mgrimesix mgrimesix left a comment

Choose a reason for hiding this comment

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

I don't see CI tests for new_style in the middleware companion PR.

Not directly part of this PR, but on line 58 ErrnoMixin is imported but not used.
Also....
Not that I particularly care, but Flake8 does and it's specified in pep8. https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements
When combining an argument annotation with a default value, however, do use spaces around the = sign
I'm not requiring any change, just commenting.

@themylogin
Copy link
Contributor Author

I don't see CI tests for new_style in the middleware companion PR.

What's new_style?

Not directly part of this PR, but on line 58 ErrnoMixin is imported but not used.

It's used by those who do from api_client import ErrnoMixin

When combining an argument annotation with a default value, however, do use spaces around the = sign

What line are you referring to?

@mgrimesix
Copy link

I don't see CI tests for new_style in the middleware companion PR.

What's new_style?

Sorry, typo new-style, but Brian has already commented on CI in truenas/middleware#16128

Not directly part of this PR, but on line 58 ErrnoMixin is imported but not used.

It's used by those who do from api_client import ErrnoMixin

OK, thanks for clearing that up. 👍

When combining an argument annotation with a default value, however, do use spaces around the = sign

What line are you referring to?

This is flake8 religiously following pep8 and not my personal preference.
There are many lines. Any function that uses annotation and default setting where the = doesn't have spaces.
e.g.
def __init__(self, url: str, *, client: 'JSONRPCClient', reserved_ports: bool=False, verify_ssl: bool=True):

@themylogin
Copy link
Contributor Author

Sorry, typo new-style, but Brian has already commented on CI in truenas/middleware#16128

Sorry, still don't understand what are you talking about? What needs to be tested?

@themylogin
Copy link
Contributor Author

@mgrimesix i fixed existing PEP8 issues in another PR

Comment on lines +501 to +510
if self._new_style_jobs:
# With new-style jobs, the method return value will not be sent until the job is completed
# We expect just to receive job ID immediately, so let's set call return value to the
# newly added job ID.
if params['collection'] == 'core.get_jobs' and params['msg'] in ['added', 'changed']:
for message_id in params['fields']['message_ids']:
if (call := self._calls.get(message_id)) is not None:
call.result = params['id']
call.returned.set()
self._unregister_call(call)

Choose a reason for hiding this comment

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

Sorry, still don't understand what are you talking about? What needs to be tested?

Testing the above path.
Let me know if the existing set of tests already cover it. Maybe point one out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mgrimesix new middleware uses new-style jobs, so any test that runs a job tests the above path.

@themylogin themylogin merged commit a81b166 into master Apr 8, 2025
2 checks passed
@themylogin themylogin deleted the NAS-135049 branch April 8, 2025 10:28
@bugclerk
Copy link

bugclerk commented Apr 8, 2025

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Apr 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants