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

Give more detail when we cannot process a non-JSON streamed line #1186

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

AlanCoding
Copy link
Member

The error handling for this in AWX has been really unforgivably bad. This abuses result_traceback somewhat, but this practice already existed in AWX. More information is better than less, is the main idea I'm following here.

@AlanCoding AlanCoding requested a review from a team as a code owner January 27, 2023 22:23
@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Jan 27, 2023
@@ -244,8 +244,11 @@ def run(self):
try:
line = self._input.readline()
data = json.loads(line)
except (json.decoder.JSONDecodeError, IOError):
self.status_callback({'status': 'error', 'job_explanation': 'Failed to JSON parse a line from worker stream.'})
except (json.decoder.JSONDecodeError, IOError) as exc:
Copy link
Member

Choose a reason for hiding this comment

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

@AlanCoding Thanks for the patch. Could you please add a test for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for the delay. I agree.

I just pushed a change where I modified some existing tests. There was effectively already coverage, but I added more detail to the assertions.

Pack the line information into job_explanation for technical reasons

Limit line length in these error messages to print to 1000 characters

Update tests to check for more error reporting
@Shrews Shrews merged commit 1d04ddb into ansible:devel Mar 7, 2023
@Shrews Shrews removed the needs_triage New item that needs to be triaged label Mar 7, 2023
@Shrews
Copy link
Contributor

Shrews commented Mar 7, 2023

Thanks. Backport PRs are requested (git cherry-pick -x, please) if you want this in 2.2 or 2.3 releases.

@AlanCoding
Copy link
Member Author

Right now I would say "no" to a 2.3 backport. There are a number of error-handling related fixes, and I don't think this would be the most major.

AlanCoding added a commit to AlanCoding/ansible-runner that referenced this pull request Jun 8, 2023
…ible#1186)

Pack the line information into job_explanation for technical reasons

Limit line length in these error messages to print to 1000 characters

Update tests to check for more error reporting
Shrews pushed a commit that referenced this pull request Jun 13, 2023
…) (#1258)

Pack the line information into job_explanation for technical reasons

Limit line length in these error messages to print to 1000 characters

Update tests to check for more error reporting
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.

None yet

4 participants