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

Upgrade logging #113

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Upgrade logging #113

wants to merge 15 commits into from

Conversation

diogoaihara
Copy link
Contributor

  • Create logging wrapper
  • Remove logging handler

@diogoaihara diogoaihara marked this pull request as ready for review October 20, 2022 20:04
Copy link
Collaborator

@Mr-Lopes Mr-Lopes left a comment

Choose a reason for hiding this comment

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

Please see comments

summary_of_records = execution.summary_of_records
msg = f"{execution_counter}. {key}:\n \
- Type: {str(execution.destination.destination_type)[16:]}\n \
- Total records: {summary_of_records['total']}\n \
Copy link
Collaborator

Choose a reason for hiding this comment

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

total_records is never set, making the total always equal to 0.

Copy link
Collaborator

@Mr-Lopes Mr-Lopes left a comment

Choose a reason for hiding this comment

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

Added comments.

@@ -132,14 +132,14 @@ def _do_upload_data(
'conversions': conversions,
}

logger.info(f'Conversions: \n{conversions}')
logger.info(f'Conversions: \n{conversions}', execution=execution)
Copy link
Collaborator

Choose a reason for hiding this comment

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

when executing in a container, the execution parameter throws an error:

"Traceback (most recent call last):
  File "apache_beam/runners/common.py", line 1198, in apache_beam.runners.common.DoFnRunner.process
  File "apache_beam/runners/common.py", line 537, in apache_beam.runners.common.SimpleInvoker.invoke_process
  File "/app/megalista_dataflow/uploaders/utils.py", line 74, in inner
    logger.info(f'Uploading {len(batch.elements)} rows...', execution=batch.execution)
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1446, in info
    self._log(INFO, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'execution'"

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