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

REVIEW ONLY - Track jid in proc file for runners #5

Merged
merged 21 commits into from
Mar 18, 2019

Conversation

austinpapp
Copy link

  • Added support functions to handle reading proc files master side
  • Added clean proc dir for master side
  • dateutil is not always there
  • async option for ShellTestCase/ShellCase

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.

except Exception as err:
# need to add serial exception here
# Could not read proc file
log.warrning("Issue deserializing data: %s", err)

Choose a reason for hiding this comment

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

Suggested change
log.warrning("Issue deserializing data: %s", err)
log.warning("Issue deserializing data: %s", err)

Copy link
Author

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

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?

Suggested change
from tests.support.runtests import RUNTIME_VARS

Copy link
Author

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

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

Copy link

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])

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:

Suggested change
assert any([job['jid'] == jid for job in jobs])
jids = [job['jid'] for job in jobs]
assert jids.count(jid) == 1

Copy link
Author

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:
Copy link

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?

Copy link
Author

@austinpapp austinpapp Feb 13, 2019

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)
Copy link

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?

Copy link
Author

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.

return False

cmdline_file = "/proc/{}/cmdline".format(pid)
Copy link

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

Copy link
Author

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
Copy link

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

@austinpapp austinpapp force-pushed the master_proc_file branch 5 times, most recently from f8f522a to aeddd21 Compare February 13, 2019 19:25
* 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
Austin Papp and others added 8 commits February 28, 2019 16:27
* 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
@austinpapp austinpapp merged commit 63cdd3a into develop Mar 18, 2019
sbrennan4 pushed a commit that referenced this pull request Aug 19, 2019
Add event_listen_queue_max_seconds to fix saltstack#53411
mattp- pushed a commit that referenced this pull request Oct 21, 2019
Only use the provider conf.d file we are testing
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.

4 participants