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

promote code for 0.29 #1331

Merged
merged 38 commits into from
Jan 13, 2024
Merged
Changes from 8 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3fefcfa
Fix for #1301 of duplicate default permission requests
gconklin Oct 19, 2023
25a59d0
Fixed type annotation for workbook.refresh
pes-magic Nov 13, 2023
400c966
Merge pull request #1319 from pes-magic/issue-1318
jacalata Nov 16, 2023
5b73beb
Remove comment with fake password that was causing confusion
bcantoni Nov 18, 2023
b7d4729
Merge pull request #1323 from tableau/clean-up-comments
jacalata Nov 20, 2023
082cec0
Add all missing fields
jorwoods Oct 26, 2023
613334b
Make imports absolute
jorwoods Oct 15, 2023
2082414
Add types to TaskItem
jorwoods Oct 15, 2023
0a720e9
Make Tasks endpoint imports absolute
jorwoods Oct 15, 2023
cdbaf98
Add task test asset
jorwoods Oct 15, 2023
e65ca39
More typing of TaskItem
jorwoods Oct 15, 2023
600a0b7
Permit missing tasks missing schedule
jorwoods Oct 15, 2023
b44d69e
Fix import references
jorwoods Oct 15, 2023
f428031
Add test for missing schedule
jorwoods Oct 15, 2023
95d6697
Formatting
jorwoods Oct 15, 2023
82ff83a
Add type annotations
jorwoods Oct 15, 2023
36a5547
Permit creation of tasks without schedules
jorwoods Oct 15, 2023
11656c4
Fix logging format
jorwoods Oct 16, 2023
246b449
issue-1299 set empty async response to None
kykrueger Oct 19, 2023
88d4614
issue-1299 remove unused import
kykrueger Oct 19, 2023
3ff3131
issue-1299 fix timeout missed when longer than 60s
kykrueger Oct 19, 2023
f7d60f9
issue-1299 paint it black
kykrueger Oct 20, 2023
538324e
issue-1299 raise exception when returned from blocking request
kykrueger Oct 25, 2023
5653a3e
issue-1299 black line length 120
kykrueger Nov 15, 2023
b5f5caa
Merge pull request #1307 from jorwoods/jorwoods/req_opts_fields
jacalata Nov 29, 2023
1f9088f
fix: correct type hint on download_revision revision_number
jorwoods Dec 2, 2023
f42948a
fix: handle filename* in download response
jorwoods Dec 10, 2023
76559d4
style: black formatting
jorwoods Dec 10, 2023
19a9f51
fix: strip typing from fix_filename
jorwoods Dec 10, 2023
f17a75d
add support for multiple intervals for hourly, daily, and monthly sch…
a-torres-2 Dec 13, 2023
e8c9e0a
Merge branch 'master' into schedules-multiple-intervals
jacalata Jan 4, 2024
666fcd8
Merge pull request #1330 from jorwoods/jorwoods/download_hotfix
jacalata Jan 4, 2024
e72552d
Merge pull request #1328 from a-torres-2/schedules-multiple-intervals
jacalata Jan 4, 2024
696f20d
Merge pull request #1297 from jorwoods/jorwoods/tasks_no_schedule
jacalata Jan 4, 2024
e0581ce
Merge branch 'development' into issue-1299
jacalata Jan 4, 2024
52d7f7c
Merge pull request #1300 from kykrueger/issue-1299
jacalata Jan 4, 2024
95755be
Merge branch 'development' into 1301-fix-duplicate-permission-requests
jacalata Jan 6, 2024
d79ca4c
Merge pull request #1302 from gconklin/1301-fix-duplicate-permission-…
jacalata Jan 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tableauserverclient/config.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
# For when a datasource is over 64MB, break it into 5MB(standard chunk size) chunks
CHUNK_SIZE_MB = 5 * 10 # 5MB felt too slow, upped it to 50

DELAY_SLEEP_SECONDS = 10
DELAY_SLEEP_SECONDS = 0.1

# The maximum size of a file that can be published in a single request is 64MB
FILESIZE_LIMIT_MB = 64
45 changes: 22 additions & 23 deletions tableauserverclient/server/endpoint/endpoint.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
from time import sleep
from tableauserverclient import datetime_helpers as datetime

import requests
from packaging.version import Version
from functools import wraps
from xml.etree.ElementTree import ParseError
@@ -76,7 +75,7 @@ def set_user_agent(parameters):
# return explicitly for testing only
return parameters

def _blocking_request(self, method, url, parameters={}) -> Optional["Response"]:
def _blocking_request(self, method, url, parameters={}) -> Optional[Union["Response", Exception]]:
self.async_response = None
response = None
logger.debug("[{}] Begin blocking request to {}".format(datetime.timestamp(), url))
@@ -95,39 +94,37 @@ def _blocking_request(self, method, url, parameters={}) -> Optional["Response"]:
return self.async_response

def send_request_while_show_progress_threaded(
self, method, url, parameters={}, request_timeout=0
) -> Optional["Response"]:
self, method, url, parameters={}, request_timeout=None
) -> Optional[Union["Response", Exception]]:
try:
request_thread = Thread(target=self._blocking_request, args=(method, url, parameters))
request_thread.async_response = -1 # type:ignore # this is an invented attribute for thread comms
request_thread.start()
except Exception as e:
logger.debug("Error starting server request on separate thread: {}".format(e))
return None
seconds = 0
seconds = 0.05
minutes = 0
sleep(1)
if self.async_response != -1:
last_log_minute = 0
sleep(seconds)
if self.async_response is not None:
# a quick return for any immediate responses
return self.async_response
while self.async_response == -1 and (request_timeout == 0 or seconds < request_timeout):
self.log_wait_time_then_sleep(minutes, seconds, url)
timed_out: bool = request_timeout is not None and seconds > request_timeout
while (self.async_response is None) and not timed_out:
sleep(DELAY_SLEEP_SECONDS)
seconds = seconds + DELAY_SLEEP_SECONDS
if seconds >= 60:
seconds = 0
minutes = minutes + 1
minutes = int(seconds / 60)
last_log_minute = self.log_wait_time(minutes, last_log_minute, url)
return self.async_response

def log_wait_time_then_sleep(self, minutes, seconds, url):
def log_wait_time(self, minutes, last_log_minute, url) -> int:
logger.debug("{} Waiting....".format(datetime.timestamp()))
if seconds >= 60: # detailed log message ~every minute
if minutes % 5 == 0:
logger.info(
"[{}] Waiting ({} minutes so far) for request to {}".format(datetime.timestamp(), minutes, url)
)
else:
logger.debug("[{}] Waiting for request to {}".format(datetime.timestamp(), url))
sleep(DELAY_SLEEP_SECONDS)
if minutes > last_log_minute: # detailed log message ~every minute
logger.info("[{}] Waiting ({} minutes so far) for request to {}".format(datetime.timestamp(), minutes, url))
last_log_minute = minutes
else:
logger.debug("[{}] Waiting for request to {}".format(datetime.timestamp(), url))
return last_log_minute

def _make_request(
self,
@@ -151,7 +148,7 @@ def _make_request(
# a request can, for stuff like publishing, spin for ages waiting for a response.
# we need some user-facing activity so they know it's not dead.
request_timeout = self.parent_srv.http_options.get("timeout") or 0
server_response: Optional["Response"] = self.send_request_while_show_progress_threaded(
server_response: Optional[Union["Response", Exception]] = self.send_request_while_show_progress_threaded(
method, url, parameters, request_timeout
)
logger.debug("[{}] Async request returned: received {}".format(datetime.timestamp(), server_response))
@@ -163,6 +160,8 @@ def _make_request(
if server_response is None:
logger.debug("[{}] Request failed".format(datetime.timestamp()))
raise RuntimeError
if isinstance(server_response, Exception):
raise server_response
self._check_status(server_response, url)

loggable_response = self.log_response_safely(server_response)