-
Notifications
You must be signed in to change notification settings - Fork 7
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
Getting "ValueError" error while connecting to client #187
Comments
This sounds a bit like a problem with mismatching python modules. Can you provide the output of |
Thank you for your reply. Following are the libraries of my python virtual environment
|
I did some investigation and I found that this error message is present in async def aget_history(server: str, token: str, metric: str, start_time: str, end_time: str) -> None:
# Connect to the server
client = metricq.HistoryClient(token=token, url=server)
await client.connect()
logger.info("connected")
zone_offset = datetime.now(pytz.timezone('CET')).strftime('%z')
parsed_match = re.compile(r'[+-]*(\d{2})(\d{2})').findall(zone_offset)[0]
zone_delta = metricq.Timedelta.from_timedelta(timedelta(hours=int(parsed_match[0]),minutes=int(parsed_match[1])))
total_begin = metricq.Timestamp.from_iso8601(start_time)
total_begin = total_begin - zone_delta
total_end = metricq.Timestamp.from_iso8601(end_time)
total_end = total_end - zone_delta
time_diff = total_end-total_begin
chunk_duration = metricq.Timedelta.from_timedelta(timedelta(seconds=time_diff.s))
interval_max_raw = metricq.Timedelta(0)
chunk_begin = total_begin
node_name = metric.split(".")[1]
df = pd.DataFrame(columns=[f"{node_name}_power_watt"])
while chunk_begin < total_end:
chunk_end = chunk_begin + chunk_duration
chunk_end = min(chunk_end, total_end)
click.echo(f"Requesting chunk from {chunk_begin} to {chunk_end}")
result = await client.history_data_request(
metric,
start_time=chunk_begin,
end_time=chunk_end,
interval_max=interval_max_raw,
request_type=HistoryRequestType.FLEX_TIMELINE,
)
for tv in result.values():
# The DB can give you one value before the requested begin timestamp
if tv.timestamp < chunk_begin:
continue
tp = str(tv.timestamp).split("]")[1]
tp = parser.parse(tp)
tp = datetime.fromtimestamp(tp.timestamp()).isoformat() + "Z"
df.loc[tp] = tv.value
chunk_begin = chunk_end
await client.stop(None)
return df I am calling the above function as follows: @click.command()
@click.option("--server", default="amqp://localhost/")
@click.option("--token", default="history-py-dummy")
@click.option("--exp_dir")
@click_log.simple_verbosity_option(logger) # type: ignore
def get_history(server: str, token: str, exp_dir: str) -> None:
[...]
# Get master metric
df_master = asyncio.run(
aget_history(server, token, myinfo["master_metric"], myinfo["start_time"], myinfo["end_time"])
)
[...]
if __name__ == "__main__":
get_history() |
This is working if I pass client = metricq.HistoryClient(token=token, url=server, client_version="1.0.1.dev1+<some-value>") To clarify more about this issue. I haven't installed any examples from this git repository. I am using my own python scripts and my own virtual environment. But then in such cases what values should be passed to the "client_version" ? The documentation does mention that I can use the git tags as the In my opinion this issue can be closed after I get some feedback of above question. |
While connecting to client, I am getting following error
I am using example scripts mentioned here. In this example, I get the error at line 53. I have also gone through the documentation. But I couldn't find any troubleshooting guide related to this topic.
I am currently using metricq with version 5.3.0.
The text was updated successfully, but these errors were encountered: