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

Error lineage - airflow_provider_openmetadata #14320

Closed
fredericocotrim opened this issue Dec 8, 2023 · 1 comment · Fixed by #14487
Closed

Error lineage - airflow_provider_openmetadata #14320

fredericocotrim opened this issue Dec 8, 2023 · 1 comment · Fixed by #14487
Assignees
Labels
bug Something isn't working Ingestion

Comments

@fredericocotrim
Copy link

Affected module

Ingestion Framework

Describe the bug

Error: 'int' object has no attribute 'timestamp'

2023-12-07, 19:18:24 UTC] {callback.py:105} ERROR - Traceback (most recent call last):
  File "/home/***/.local/lib/python3.8/site-packages/***_provider_openmetadata/lineage/callback.py", line 97, in success_callback
    add_status(
  File "/home/***/.local/lib/python3.8/site-packages/***_provider_openmetadata/lineage/status.py", line 116, in add_status
    timestamp=datetime_to_ts(execution_date),
  File "/home/***/.local/lib/python3.8/site-packages/metadata/utils/helpers.py", line 183, in datetime_to_ts
    return int(date.timestamp() * 1_000) if date else None
AttributeError: 'int' object has no attribute 'timestamp'

[2023-12-07, 19:18:24 UTC] {callback.py:106} ERROR - Lineage Callback exception 'int' object has no attribute 'timestamp'
[2023-12-07, 19:18:24 UTC] {local_task_job.py:212} INFO - Task exited with return code 0
[2023-12-07, 19:18:24 UTC] {taskinstance.py:2596} INFO - 0 downstream tasks scheduled from follow-on schedule check

Version:

  • OS: linux
  • Python version: 3.8
  • OpenMetadata version: 1.2.2
  • OpenMetadata Ingestion package version: openmetadata-ingestion==1.2.2

Additional context

In the add_status method of the file "/ingestion/src/airflow_provider_openmetadata/lineage/status.py" the execution_date is converted twice using the function datetime_to_ts:

    # Let this fail if we cannot properly extract & cast the start_date
    execution_date = datetime_to_ts(dag_run.execution_date)
    operator.log.info(f"Logging pipeline status for execution {execution_date}")
    updated_status = PipelineStatus(
        timestamp=datetime_to_ts(execution_date),
        executionStatus=get_dag_status(
            all_tasks=dag.task_ids,
            task_status=updated_task_status,
        ),
        taskStatus=updated_task_status,
    )

I resolved the error by replacing the line:

execution_date = datetime_to_ts(dag_run.execution_date)

with

execution_date = dag_run.execution_date
@pmbrull pmbrull self-assigned this Dec 14, 2023
@pmbrull pmbrull added Ingestion bug Something isn't working labels Dec 14, 2023
@pmbrull pmbrull moved this to Ingestion - Bugs & Minor Features in Release 1.3.0 Dec 14, 2023
@pmbrull
Copy link
Collaborator

pmbrull commented Dec 21, 2023

thank you for the detailed analysis. Appreciate it. Will take care of this

pmbrull added a commit to pmbrull/OpenMetadata that referenced this issue Dec 22, 2023
pmbrull added a commit to pmbrull/OpenMetadata that referenced this issue Dec 22, 2023
pmbrull added a commit that referenced this issue Dec 22, 2023
* #14320 - don't cast twice

* #14320 - Fix Airflow Callback datetime conversion

* import
@TeddyCr TeddyCr moved this from Ingestion - Bugs & Minor Features to Done in Release 1.3.0 Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Ingestion
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants