Open apurvkulkarni7 opened 6 months ago
This sounds a bit like a problem with mismatching python modules. Can you provide the output of pip list
?
Thank you for your reply. Following are the libraries of my python virtual environment
Package Version
----------------------------- ---------------
aio-pika 9.4.1
aiormq 6.8.0
alabaster 0.7.16
appdirs 1.4.4
arrow 1.3.0
astroid 3.0.2
asttokens 2.4.1
atomicwrites 1.4.1
attrs 23.2.0
autopep8 2.0.4
Babel 2.14.0
backcall 0.2.0
beautifulsoup4 4.12.3
beniget 0.4.1
binaryornot 0.4.4
black 23.12.1
bleach 6.1.0
blinker 1.4
Brotli 1.0.9
certifi 2023.11.17
chardet 5.2.0
charset-normalizer 3.3.2
click 8.0.3
click-completion 0.5.2
click-log 0.4.0
cloudpickle 3.0.0
colorama 0.4.4
comm 0.2.1
command-not-found 0.3
cookiecutter 2.5.0
cryptography 3.4.8
cupshelpers 1.0
cycler 0.11.0
dbus-python 1.2.18
debugpy 1.8.0
decorator 5.1.1
defusedxml 0.7.1
Deprecated 1.2.14
diff-match-patch 20230430
dill 0.3.7
distro 1.7.0
distro-info 1.1+ubuntu0.2
docstring-to-markdown 0.13
docutils 0.20.1
dominate 2.9.1
entrypoints 0.4
exceptiongroup 1.2.0
executing 2.0.1
fastjsonschema 2.19.1
flake8 6.1.0
fonttools 4.29.1
fs 2.4.12
fuse-python 1.0.2
gast 0.5.2
gpg 1.23.2-unknown
helpdev 0.7.1
html5lib 1.1
httplib2 0.20.2
idna 3.6
imagesize 1.4.1
importlib-metadata 7.0.1
inflection 0.5.1
intervaltree 3.1.0
ipykernel 6.29.0
ipython 8.20.0
ipython_genutils 0.2.0
isort 5.13.2
jedi 0.19.1
jeepney 0.7.1
jellyfish 1.0.3
Jinja2 3.1.3
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_client 8.6.0
jupyter_core 5.7.1
jupyterlab_pygments 0.3.0
keyring 23.5.0
kiwisolver 1.3.2
language-selector 0.1
launchpadlib 1.10.16
lazr.restfulclient 0.14.4
lazr.uri 1.0.6
lazy-object-proxy 0.0.0
logilab-common 1.8.2
lxml 4.8.0
lz4 3.1.3+dfsg
markdown-it-py 3.0.0
MarkupSafe 2.1.4
matplotlib 3.5.1
matplotlib-inline 0.1.6
mccabe 0.7.0
mdurl 0.1.2
mercurial 6.1.1
metricq 5.3.0
mistune 3.0.2
mock 4.0.3
more-itertools 8.10.0
mpmath 0.0.0
multidict 6.0.5
mypy-extensions 1.0.0
nbclient 0.9.0
nbconvert 7.14.2
nbformat 5.9.2
nest-asyncio 1.6.0
netifaces 0.11.0
numpy 1.26.3
numpydoc 1.6.0
oauthlib 3.2.0
olefile 0.46
openshot-qt 3.1.1
packaging 23.2
pamqp 3.3.0
pandas 2.2.0
pandocfilters 1.5.1
parso 0.8.3
pathspec 0.12.1
pbr 5.8.0
pep8 1.7.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.0.1
pip 23.2.1
platformdirs 4.1.0
pluggy 1.3.0
ply 3.11
prompt-toolkit 3.0.43
protobuf 3.12.4
psutil 5.9.8
ptyprocess 0.7.0
pure-eval 0.2.2
py 1.10.0
pyarrow 15.0.2
pycairo 1.20.1
pycodestyle 2.11.1
pycups 2.0.1
pydocstyle 6.3.0
pyflakes 3.1.0
pygdbmi 0.11.0.0
Pygments 2.17.2
PyGObject 3.42.1
PyJWT 2.3.0
pylibacl 0.6.0
pylint 3.0.3
pylint-venv 3.0.3
pyls-black 0.4.6
pyls-spyder 0.4.0
pyparsing 2.4.7
PyQt5 5.15.10
PyQt5-sip 12.13.0
PyQtWebEngine 5.15.6
PyQtWebEngine-Qt5 5.15.2
pyrsistent 0.18.1
pysvn 1.9.15
python-apt 2.4.0+ubuntu3
python-dateutil 2.8.2
python-jsonrpc-server 0.4.0
python-language-server 0.36.2
python-lsp-black 2.0.0
python-lsp-jsonrpc 1.1.2
python-lsp-server 1.9.0
python-slugify 8.0.1
pythran 0.14.0
pytoolconfig 1.3.1
pytz 2022.1
pyxattr 0.7.2
pyxdg 0.28
PyYAML 5.4.1
pyzmq 25.1.2
QDarkStyle 3.2.3
qstylizer 0.2.2
QtAwesome 1.3.0
qtconsole 5.5.1
QtPy 2.4.1
referencing 0.32.1
reportlab 3.6.8
requests 2.31.0
rich 13.7.0
roman 3.3
rope 1.12.0
rpds-py 0.17.1
Rtree 1.2.0
scipy 1.8.0
SecretStorage 3.3.1
sentry-sdk 1.4.3
setuptools 68.2.0
shellingham 1.5.4
six 1.16.0
snowballstemmer 2.2.0
sortedcontainers 2.4.0
soupsieve 2.5
Sphinx 7.2.6
sphinxcontrib-applehelp 1.0.8
sphinxcontrib-devhelp 1.0.6
sphinxcontrib-htmlhelp 2.0.5
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.7
sphinxcontrib-serializinghtml 1.1.10
spyder 5.5.0
spyder-kernels 2.5.0
ssh-import-id 5.11
stack-data 0.6.3
sympy 1.9
tabulate 0.9.0
testpath 0.5.0
text-unidecode 1.3
textdistance 4.6.1
three-merge 0.1.1
tinycss2 1.2.1
toml 0.10.2
tomli 2.0.1
tomlkit 0.12.3
tornado 6.4
traitlets 5.14.1
types-python-dateutil 2.8.19.20240106
typing_extensions 4.9.0
tzdata 2023.4
ubuntu-drivers-common 0.0.0
ufoLib2 0.13.1
ufw 0.36.1
ujson 5.9.0
unicodedata2 14.0.0
urllib3 2.1.0
wadllib 1.3.6
watchdog 3.0.0
wcwidth 0.2.13
webencodings 0.5.1
whatthepatch 1.0.5
wheel 0.41.2
wrapt 1.13.3
wurlitzer 3.0.3
xdg 5
xkit 0.0.0
yapf 0.40.2
yarl 1.9.4
zipp 1.0.0
I did some investigation and I found that this error message is present in yarl
python library. As seen above, I am using yarl==1.9.4
. Is there any version recommendation? To add to that following is my full code to extract metrics (historical data) from a MetricQ server, which is inspired from the examples.
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_version="1.0.1.dev1+<some-value>"
to the History client as follows:
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 client_version
. But I am confused as the documentation shows the use case of working with git repository. But my use case is totally different where I am using only a python script to extract the data.
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.