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

Add metadata to json decode errors #2860

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

ABrain7710
Copy link
Contributor

Description

  • Currently we are logging the output when we get the json code errors in parse_json_from_subprocess_call but it is impossible to find these logs in the huge log files so I added the exception so that the relevant data will show up in flower

Signed commits

  • Yes, I signed my commits.

@@ -0,0 +1,8 @@
class MetadataException(Exception):
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0114: Missing module docstring (missing-module-docstring)

@@ -0,0 +1,8 @@
class MetadataException(Exception):
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0115: Missing class docstring (missing-class-docstring)

@@ -11,6 +11,9 @@
import json
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
W0404: Reimport 'json' (imported line 2) (reimported)

@@ -11,6 +11,9 @@
import json
import subprocess

from augur.tasks.util.metadata_exception import MetadataException


def create_grouped_task_load(*args,processes=8,dataList=[],task=None):
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
W0102: Dangerous default value [] as argument (dangerous-default-value)

@@ -141,7 +144,7 @@ def parse_json_from_subprocess_call(logger, subprocess_arr, cwd=None):
required_output = {}
except json.decoder.JSONDecodeError as e:
logger.error(f"Could not parse required output! \n output: {output} \n Error: {e}")
raise e
raise MetadataException(e, f"output : {output}")
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
W0707: Consider explicitly re-raising using 'raise MetadataException(e, f'output : {output}') from e' (raise-missing-from)

@@ -11,6 +11,9 @@
import json
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0412: Imports from package json are not grouped (ungrouped-imports)


except Exception as e:

raise MetadataException(e, f"required_output: {required_output}")
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
W0707: Consider explicitly re-raising using 'raise MetadataException(e, f'required_output: {required_output}') from e' (raise-missing-from)

Copy link
Contributor

@IsaacMilarky IsaacMilarky left a comment

Choose a reason for hiding this comment

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

LGTM

@IsaacMilarky IsaacMilarky merged commit 48ad40b into dev Jul 8, 2024
9 checks passed
@ABrain7710 ABrain7710 deleted the add_metadata_to_subprocess_errors branch August 7, 2024 17:59
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.

2 participants