@@ -33,6 +33,32 @@ def get(self: Self, job_id: None, req_options: Optional[RequestOptionsBase]) ->
33
33
34
34
@api (version = "2.6" )
35
35
def get (self , job_id = None , req_options = None ):
36
+ """
37
+ Retrieve jobs for the site. Endpoint is paginated and will return a
38
+ list of jobs and pagination information. If a job_id is provided, the
39
+ method will return information about that specific job. Specifying a
40
+ job_id is deprecated and will be removed in a future version.
41
+
42
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#query_jobs
43
+
44
+ Parameters
45
+ ----------
46
+ job_id : str or RequestOptionsBase
47
+ The ID of the job to retrieve. If None, the method will return all
48
+ jobs for the site. If a RequestOptions object is provided, the
49
+ method will use the options to filter the jobs.
50
+
51
+ req_options : RequestOptionsBase
52
+ The request options to filter the jobs. If None, the method will
53
+ return all jobs for the site.
54
+
55
+ Returns
56
+ -------
57
+ tuple[list[BackgroundJobItem], PaginationItem] or JobItem
58
+ If a job_id is provided, the method will return a JobItem. If no
59
+ job_id is provided, the method will return a tuple containing a
60
+ list of BackgroundJobItems and a PaginationItem.
61
+ """
36
62
# Backwards Compatibility fix until we rev the major version
37
63
if job_id is not None and isinstance (job_id , str ):
38
64
import warnings
@@ -50,6 +76,33 @@ def get(self, job_id=None, req_options=None):
50
76
51
77
@api (version = "3.1" )
52
78
def cancel (self , job_id : Union [str , JobItem ]):
79
+ """
80
+ Cancels a job specified by job ID. To get a list of job IDs for jobs that are currently queued or in-progress, use the Query Jobs method.
81
+
82
+ The following jobs can be canceled using the Cancel Job method:
83
+
84
+ Full extract refresh
85
+ Incremental extract refresh
86
+ Subscription
87
+ Flow Run
88
+ Data Acceleration (Data acceleration is not available in Tableau Server 2022.1 (API 3.16) and later. See View Acceleration(Link opens in a new window).)
89
+ Bridge full extract refresh
90
+ Bridge incremental extract refresh
91
+ Queue upgrade Thumbnail (Job that puts the upgrade thumbnail job on the queue)
92
+ Upgrade Thumbnail
93
+
94
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#cancel_job
95
+
96
+ Parameters
97
+ ----------
98
+ job_id : str or JobItem
99
+ The ID of the job to cancel. If a JobItem is provided, the method
100
+ will use the ID from the JobItem.
101
+
102
+ Returns
103
+ -------
104
+ None
105
+ """
53
106
if isinstance (job_id , JobItem ):
54
107
job_id = job_id .id
55
108
assert isinstance (job_id , str )
@@ -58,13 +111,69 @@ def cancel(self, job_id: Union[str, JobItem]):
58
111
59
112
@api (version = "2.6" )
60
113
def get_by_id (self , job_id : str ) -> JobItem :
114
+ """
115
+ Returns status information about an asynchronous process that is tracked
116
+ using a job. This method can be used to query jobs that are used to do
117
+ the following:
118
+
119
+ Import users from Active Directory (the result of a call to Create Group).
120
+ Synchronize an existing Tableau Server group with Active Directory (the result of a call to Update Group).
121
+ Run extract refresh tasks (the result of a call to Run Extract Refresh Task).
122
+ Publish a workbook asynchronously (the result of a call to Publish Workbook).
123
+ Run workbook or view subscriptions (the result of a call to Create Subscription or Update Subscription)
124
+ Run a flow task (the result of a call to Run Flow Task)
125
+ Status of Tableau Server site deletion (the result of a call to asynchronous Delete Site(Link opens in a new window) beginning API 3.18)
126
+ Note: To query a site deletion job, the server administrator must be first signed into the default site (contentUrl=" ").
127
+
128
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#query_job
129
+
130
+ Parameters
131
+ ----------
132
+ job_id : str
133
+ The ID of the job to retrieve.
134
+
135
+ Returns
136
+ -------
137
+ JobItem
138
+ The JobItem object that contains information about the requested job.
139
+ """
61
140
logger .info ("Query for information about job " + job_id )
62
141
url = f"{ self .baseurl } /{ job_id } "
63
142
server_response = self .get_request (url )
64
143
new_job = JobItem .from_response (server_response .content , self .parent_srv .namespace )[0 ]
65
144
return new_job
66
145
67
146
def wait_for_job (self , job_id : Union [str , JobItem ], * , timeout : Optional [float ] = None ) -> JobItem :
147
+ """
148
+ Waits for a job to complete. The method will poll the server for the job
149
+ status until the job is completed. If the job is successful, the method
150
+ will return the JobItem. If the job fails, the method will raise a
151
+ JobFailedException. If the job is cancelled, the method will raise a
152
+ JobCancelledException.
153
+
154
+ Parameters
155
+ ----------
156
+ job_id : str or JobItem
157
+ The ID of the job to wait for. If a JobItem is provided, the method
158
+ will use the ID from the JobItem.
159
+
160
+ timeout : float | None
161
+ The maximum amount of time to wait for the job to complete. If None,
162
+ the method will wait indefinitely.
163
+
164
+ Returns
165
+ -------
166
+ JobItem
167
+ The JobItem object that contains information about the completed job.
168
+
169
+ Raises
170
+ ------
171
+ JobFailedException
172
+ If the job failed to complete.
173
+
174
+ JobCancelledException
175
+ If the job was cancelled.
176
+ """
68
177
if isinstance (job_id , JobItem ):
69
178
job_id = job_id .id
70
179
assert isinstance (job_id , str )
0 commit comments