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

fix: no longer sigterm agent when running jobs as same user #161

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

ddneilson
Copy link
Contributor

What was the problem/requirement? (What/Why)

When running jobs as the same user as the agent (i.e. the Queue's jobsRunAs user is the same os user) the agent is SIGTERMing itself when there is no work left for it to work on. It shouldn't be doing that.

What was the solution? (How)

We were doing a /usr/bin/whoami to find out who the agent is running as, but that output had a trailing newline that was interfering with the check for whether the job user and agent user are the same. This fixes that.

What is the impact of this change?

The agent can no longer be convinced to take a long walk off of a short pier.

How was this change tested?

I updated the unit tests, but also:

>>> import subprocess
>>> subprocess.check_output(["/usr/bin/whoami"], text=True)
'username\n'
>>> subprocess.check_output(["/usr/bin/whoami"], text=True).strip()
'username'

Was this change documented?

N/A

Is this a breaking change?

No

Problem:
When running jobs as the same user as the agent (i.e. the Queue's
jobsRunAs user is the same os user) the agent is SIGTERMing itself when
there is no work left for it to work on. It shouldn't be doing that.

Solution:
We were doing a /usr/bin/whoami to find out who the agent is running as,
but that output had a trailing newline that was interfering with the
check for whether the job user and agent user are the same. This fixes
that.

Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson requested a review from a team as a code owner February 16, 2024 20:26
@ddneilson ddneilson merged commit fe12ad3 into mainline Feb 16, 2024
9 checks passed
@ddneilson ddneilson deleted the ddneilson/20377 branch February 16, 2024 20:36
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