`server.jobs.wait_for_job` fails for ID generated by `create_extract`

Open
#1,093 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
50/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
api

Research direction

Start at server.jobs.wait_for_job and server.jobs.get_by_id, then compare their behavior with tsc.Pager(server.jobs) for the ID returned by server.datasources.create_extract. Reproduce the 400031 response and trace how each path queries the job; done means the generated extract job ID works with wait_for_job and get_by_id.

Written by the indexing model from the issue text.

Description

bug in-progress Server-Side Enhancement

Describe the bug
The job ID generated when creating an extract via TSC is not queryable by the server.jobs.wait_for_job method.

Versions
Details of your environment, including:

  • Tableau Server version 3.10
  • Python 3.8.12
  • tableauserverclient==0.19.0

To Reproduce

refresh_job = server.datasources.create_extract(datasource_item)
job_status = server.jobs.wait_for_job(refresh_job.id)

# Also
server.jobs.get_by_id(refresh_job.id)

Results

400031: Bad Request
    There was a problem querying job '{refresh_job.id}'.

Solution

from tableauserverclient.exponential_backoff import ExponentialBackoffTimer

refresh_job = server.datasources.create_extract(datasource_item)
backoff_timer = ExponentialBackoffTimer()

job = list(j for j in tsc.Pager(server.jobs) if j.id == refresh_job.id)[0]     
while job.ended_at is None:
    backoff_timer.sleep()
    print(f"{refresh_job.id} still running")
    job = list(j for j in tsc.Pager(server.jobs) if j.id == refresh_job.id)[0]
Dominant language
Python
Stars
716
Forks
446
Avg merge
8d 8h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tableau/server-client-python

All issues in tableau/server-client-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.