-
Notifications
You must be signed in to change notification settings - Fork 6
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
REVIEW ONLY - Track jid in proc file for runners #5
Conversation
salt/utils/master.py
Outdated
except Exception as err: | ||
# need to add serial exception here | ||
# Could not read proc file | ||
log.warrning("Issue deserializing data: %s", err) |
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.
log.warrning("Issue deserializing data: %s", err) | |
log.warning("Issue deserializing data: %s", err) |
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.
will fix.
from tests.support.unit import skipIf | ||
from tests.support.case import ShellTestCase | ||
from tests.support.paths import TMP_ROOT_DIR | ||
from tests.support.runtests import RUNTIME_VARS |
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.
Doesn't look like this is used. Does it need to be imported?
from tests.support.runtests import RUNTIME_VARS |
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.
will fix.
@@ -6,11 +6,16 @@ | |||
import logging | |||
import os | |||
|
|||
import dateutil.parser as dateutil_parser | |||
try: | |||
import dateutil.parser as dateutil_parser |
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.
Just wondering, was the test working before in master? - Couldn't we add to the dev.txt requirements
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.
this is a PR for upstream not salt-core
jid = ret['jid'] | ||
time.sleep(2) | ||
jobs = master.get_running_jobs(DEFAULT_CONFIG) | ||
assert any([job['jid'] == jid for job in jobs]) |
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.
This is nitpicky of me, but this asserts that there could be multiple jobs with the same jid (Which should never happen).
Could we change, to assert that one and only one jobs has the wanted jid:
assert any([job['jid'] == jid for job in jobs]) | |
jids = [job['jid'] for job in jobs] | |
assert jids.count(jid) == 1 |
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.
meh. but i can change it.
# Job has finished or issue found, so let's clean up after ourselves | ||
try: | ||
os.remove(jid_proc_file) | ||
except OSError as err: |
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.
you catch ioerror below but only soerror here, why?
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.
well, im not actually reading it so there is no ioerror possible.
try: | ||
proc = psutil.Process(pid) | ||
except psutil.NoSuchProcess: | ||
log.warning("PID %s is no longer running.", pid) |
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.
is a warning necessary here. maybe its called in cases where pid being dead/finished isnt an error?
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.
yea i was on the fence with that. technically this should never happen because "things" should clean up after themselves. i didnt want to generate an error bc i thought that was a bit much.
salt/utils/master.py
Outdated
return False | ||
|
||
cmdline_file = "/proc/{}/cmdline".format(pid) |
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.
you should probably use os.path.join
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.
true.
@@ -6,11 +6,16 @@ | |||
import logging | |||
import os | |||
|
|||
import dateutil.parser as dateutil_parser | |||
try: | |||
import dateutil.parser as dateutil_parser |
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.
this is a PR for upstream not salt-core
f8f522a
to
aeddd21
Compare
* Added support functions to handle reading proc files master side * Added clean proc dir for master side * Added dateutil and setproctile to tests.txt * async option for ShellTestCase/ShellCase
e3ea314
to
c466103
Compare
…into master_proc_file
also added flaky to the test
56c0de2
to
b0a45e9
Compare
* Added support functions to handle reading proc files master side * Added clean proc dir for master side * Added dateutil and setproctile to tests.txt * async option for ShellTestCase/ShellCase
also added flaky to the test
eaa535c
to
365c607
Compare
Add event_listen_queue_max_seconds to fix saltstack#53411
Only use the provider conf.d file we are testing
What does this PR do?
What issues does this PR fix or reference?
Previous Behavior
Remove this section if not relevant
New Behavior
Remove this section if not relevant
Tests written?
Yes/No
Commits signed with GPG?
Yes/No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.