-
Notifications
You must be signed in to change notification settings - Fork 186
Timeout cannot be specify as a float
#383
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
Comments
I did some more tests and landed on another small issue that crippled my progress for a while: when the given timeout (e.g. |
Hi @cellcubeBaMa, thanks for using our client. The following properties are related only for So your code can be simplify to: import copy
import datetime
from typing import List
import numpy as np
import pandas as pd
from influxdb_client import InfluxDBClient
from influxdb_client.client.write_api import SYNCHRONOUS
if __name__ == '__main__':
t_col = "time"
token = "my-token"
org = "my-org"
url = "http://localhost:8086"
bucket = "my-bucket"
def create_data(time_col: str):
x = np.arange(1, 10)
now = datetime.datetime.utcnow().timestamp()
time_data = [now - 10 - xxx for xxx in x]
y = x ** 2
frame = pd.DataFrame({time_col: time_data, 'x': x, 'y': y})
tag_name = 'some_tag'
tags: List[str] = [tag_name]
frame[tag_name] = "very"
frame[time_col] = frame[time_col].apply(lambda x: datetime.datetime.fromtimestamp(x))
frame = copy.deepcopy(frame.set_index(time_col))
return frame, tags
with InfluxDBClient(url=url, token=token, org=org, debug=True, timeout=1000) as influx_client:
print("write started")
writer = influx_client.write_api(write_options=SYNCHRONOUS)
for i in range(0, 10000):
df, tag_list = create_data(time_col=t_col)
writer.write(
bucket=bucket,
org=org,
record=df,
data_frame_measurement_name="test-01",
data_frame_tag_columns=tag_list,
)
print("done!") I've tried your code and everything works perfectly. I've pause the InfluxDB container and Which version of
Regards |
Thanks for the quick reply! I figured it out - it's what I wrote in my second comment. I specified the timeout as a float before, the retries apparently had nothing to do with it. I don't know where I messed this up testing yesterday, but I spent the whole day on this sigh. Mea culpa. I humbly suggest adding a check so the timeout cannot be specified as a float. With
I'm disconnecting on the OS-side by the way, turning off the WiFi-Adapter or connecting to a different network / disconnecting from the network the database is in. fyi |
Thanks for your detail investigation. We will add supports for specify timeout as |
float
no problem at all |
Uh oh!
There was an error while loading. Please reload this page.
When the connection to the InfluxDB is lost during a write operation, no exception is raised by the python client where the
write_api
was configured with no retries UNLESS retries are also set to 0 for the InfluxDBClient instance.Steps to reproduce:
when
retries
of theInfluxDBClient
instance is set to 0 retries aurllib3.exceptions.ReadTimeoutError
occurs, which is what I'd expect to happen with the code above, e.g.influx_client = InfluxDBClient( url=url, token=token, org=org, debug=True, timeout=1000, retries=0, )
Expected behavior:
Exception to be raised after the specified amount of retries and delays of the writer
Actual behavior:
No exception raised despite connection loss.
Specifications:
The text was updated successfully, but these errors were encountered: