Cool. Note that you don't even have to parse the Json, since the result code in the Json is identical to the status_code
exposed in the requests response object
DepressedChimpanzee34 what would be easier curl
or python ?
DepressedChimpanzee34 you can just do curl
https://<hostname>/debug.ping
- no need to the API version (it's optional)
DepressedChimpanzee34 , Damn that's a shame. Then it means that to use the endpoint you'll need to implement some network communication in python (something like curl through python)
I found another one that might help:client.session.get_clients()
This will return the clearm and server versions. This should be validation enough if server is up or not.
However I'd suggest implementing some sort of ability to send POST api calls via your script.
The highlighted line is exactly that. Instead of client.tasks.get_all()
I think it would be along the lines of client.debug.ping()
is there a chance you help me with the specific POST call for debug? I was trying to implement it using requests package but I got errors.. didn't work for me.. I believe it something trivial
SuccessfulKoala55 , thanks I was looking for a way to do it programatically.. solved now, thanksrequest = url+ '/v2.14/debug.ping' r = requests.post(request) serverIsResponsive = r.json()['meta']['result_code'] == 200
I tried also with the app website..
I'm just trying to see what is the default server that is set, and is it responsive
I'm assuming you mean your own server, not the demo server, is that correct ?
and then second part is to check if it is up and alive
Yes, you can curl
to the ping endpoint :
https://clear.ml/docs/latest/docs/references/api/debug#post-debugping
Hmmm, maybe you could save it as an env var. There isn't a 'default' server per say since you can deploy anywhere yourself. Regarding to check if it's alive, you can either check ping it with curl
or check up on the docker status of the server 🙂
nice, saved some electrons from running 🙂
AgitatedDove14 ,yes my own server
is there an available reference to such a post request? I was trying some variations and it didn't work for me
CostlyOstrich36 ,I went through tasks and session and couldn't find an equivalent ping
and then second part is to check if it is up and alive
no programmatic python options? could be nice..
Please implement in python the following command curl <HOST_ADDRESS>/v2.14/debug/ping
DepressedChimpanzee34 , please note the following example:
https://github.com/allegroai/clearml/blob/master/examples/services/cleanup/cleanup_service.py#L64
I marked line 64 because here is the pythonic interface to our api.
Using the following endpoint you can code it in a few lines 🙂
https://clear.ml/docs/latest/docs/references/api/debug/#post-debugping
CostlyOstrich36 thanks, is there an example for using the post\get in a pythonic way to access the mentioned debug.ping ?
AgitatedDove14 , missed your message, python
I am not familiar with this.. thats why I'm struggling.. this is what I tried:import requests import os r = requests.post(url+ '/v2.14/debug/ping') r.json()
response:{'meta': {'id': 'ebd6bdeaa95c4c3397009c71d9444040', 'trx': 'ebd6bdeaa95c4c3397009c71d9444040', 'endpoint': {'name': '', 'requested_version': 1.0, 'actual_version': None}, 'result_code': 400, 'result_subcode': 0, 'result_msg': 'Invalid request path /v2.14/debug/ping', 'error_stack': None, 'error_data': {}}, 'data': {}}
DepressedChimpanzee34 , what is the url like?
The url should be something like https://<WEBSITE>.<DOMAIN>/v2.14/debug/ping
client has the following attributes:['auth', 'events', 'models', 'projects', 'queues', 'session', 'tasks', 'workers']
response:{"meta":{"id":"33e9e80e94ee4384b45962acafcd2af5","trx":"33e9e80e94ee4384b45962acafcd2af5","endpoint":{"name":"","requested_version":1.0,"actual_version":null},"result_code":400,"result_subcode":0,"result_msg":"Invalid request path /v2.14/debug/ping","error_stack":null,"error_data":{}},"data":{}}
I am just trying to get it programatically, so sure I can read the clearml.conf file to get the server default but I thought maybe there is some attribute \ utility available for this
My bad, please use debug.ping
instead of debug/ping
does curl https://<WEBSITE>.<DOMAIN>/v2.14/debug/ping
work for you?