Skip to content

Tableau provider signs out prior to blocking refresh check #20432

Closed

Description

@ericpp

Apache Airflow version

2.2.2 (latest released)

What happened

It logs into the Tableau server, starts a refresh, and then throws a NotSignedInError exception:

[2021-12-20, 07:40:13 CST] {{base.py:70}} INFO - Using connection to: id: tableau. Host: https://xxx/, Port: None, Schema: , Login: xxx, Password: ***, extra: {}
[2021-12-20, 07:40:14 CST] {{auth_endpoint.py:37}} INFO - Signed into https://xxx/ as user with id xxx-xxx-xxx-xxx-xxx
[2021-12-20, 07:40:14 CST] {{workbooks_endpoint.py:41}} INFO - Querying all workbooks on site
[2021-12-20, 07:40:14 CST] {{tableau.py:141}} INFO - Found matching with id xxx-xxx-xxx-xxx-xxx
[2021-12-20, 07:40:14 CST] {{auth_endpoint.py:53}} INFO - Signed out
[2021-12-20, 07:40:14 CST] {{jobs_endpoint.py:41}} INFO - Query for information about job xxx-xxx-xxx-xxx-xxx
[2021-12-20, 07:40:14 CST] {{taskinstance.py:1703}} ERROR - Task failed with exception
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1332, in _run_raw_task
    self._execute_task_with_callbacks(context)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1458, in _execute_task_with_callbacks
    result = self._execute_task(context, self.task)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1509, in _execute_task
    result = execute_callable(context=context)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/tableau/operators/tableau.py", line 124, in execute
    if not tableau_hook.wait_for_state(
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/tableau/hooks/tableau.py", line 180, in wait_for_state
    finish_code = self.get_job_status(job_id=job_id)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/tableau/hooks/tableau.py", line 163, in get_job_status
    return TableauJobFinishCode(int(self.server.jobs.get_by_id(job_id).finish_code))
  File "/home/airflow/.local/lib/python3.9/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 177, in wrapper
    return func(self, *args, **kwargs)
  File "/home/airflow/.local/lib/python3.9/site-packages/tableauserverclient/server/endpoint/jobs_endpoint.py", line 42, in get_by_id
    url = "{0}/{1}".format(self.baseurl, job_id)
  File "/home/airflow/.local/lib/python3.9/site-packages/tableauserverclient/server/endpoint/jobs_endpoint.py", line 14, in baseurl
    return "{0}/sites/{1}/jobs".format(self.parent_srv.baseurl, self.parent_srv.site_id)
  File "/home/airflow/.local/lib/python3.9/site-packages/tableauserverclient/server/server.py", line 168, in site_id
    raise NotSignedInError(error)
tableauserverclient.server.exceptions.NotSignedInError: Missing site ID. You must sign in first.
[2021-12-20, 07:40:14 CST] {{taskinstance.py:1270}} INFO - Marking task as FAILED. dag_id=tableau-refresh, task_id=refresh_tableau_workbook, execution_date=20211220T194008, start_date=20211220T194013, end_date=20211220T194014

What you expected to happen

It should've logged into Tableau, started a refresh, and then waited for the refresh to finish.

How to reproduce

Use a TableauOperator with a blocking refresh:

TableauOperator(
    resource='workbooks',
    method='refresh',
    find='Tableau workbook',
    match_with='name',
    site_id='tableau_site',
    task_id='refresh_tableau_workbook',
    tableau_conn_id='tableau',
    blocking_refresh=True,
    dag=dag,
)

Operating System

Debian GNU/Linux 10 (buster)

Versions of Apache Airflow Providers

apache-airflow-providers-tableau==2.1.2

Deployment

Docker-Compose

Deployment details

I'm using the official apache/airflow:2.2.2-python3.9 Docker image

Anything else

It occurs every time I use the new TableauOperator to do a blocking refresh of a workbook.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. eladkal commented on Dec 20, 2021

    @eladkal
    Contributor

    feel free to PR a fix

  2. ericpp commented on Dec 20, 2021

    @ericpp
    ContributorAuthor

    PR attached

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions