Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi All, Is There An Easy Way To Ping The Server Programatically? I'M Just Trying To See What Is The Default Server That Is Set, And Is It Responsive

Hi all, is there an easy way to ping the server programatically?
I'm just trying to see what is the default server that is set, and is it responsive

  
  
Posted 3 years ago
Votes Newest

Answers 30


nice, saved some electrons from running 🙂

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

SuccessfulKoala55 , thanks I was looking for a way to do it programatically.. solved now, thanks
request = url+ '/v2.14/debug.ping' r = requests.post(request) serverIsResponsive = r.json()['meta']['result_code'] == 200

  
  
Posted 3 years ago

My bad, please use debug.ping instead of debug/ping

  
  
Posted 3 years ago

DepressedChimpanzee34 you can just do curl https://<hostname>/debug.ping - no need to the API version (it's optional)

  
  
Posted 3 years ago

this is what I get with curl

  
  
Posted 3 years ago

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":{}}

  
  
Posted 3 years ago

does curl https://<WEBSITE>.<DOMAIN>/v2.14/debug/ping work for you?

  
  
Posted 3 years ago

I am getting 405

  
  
Posted 3 years ago

I tried also with the app website..

  
  
Posted 3 years ago

something like
...

  
  
Posted 3 years ago

DepressedChimpanzee34 , what is the url like?
The url should be something like https://<WEBSITE>.<DOMAIN>/v2.14/debug/ping

  
  
Posted 3 years ago

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': {}}

  
  
Posted 3 years ago

Please implement in python the following command curl <HOST_ADDRESS>/v2.14/debug/ping

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

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.

  
  
Posted 3 years ago

CostlyOstrich36 ,I went through tasks and session and couldn't find an equivalent ping

  
  
Posted 3 years ago

client has the following attributes:
['auth', 'events', 'models', 'projects', 'queues', 'session', 'tasks', 'workers']

  
  
Posted 3 years ago

The highlighted line is exactly that. Instead of client.tasks.get_all() I think it would be along the lines of client.debug.ping()

  
  
Posted 3 years ago

CostlyOstrich36 thanks, is there an example for using the post\get in a pythonic way to access the mentioned debug.ping ?

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

AgitatedDove14 , missed your message, python

  
  
Posted 3 years ago

DepressedChimpanzee34 what would be easier curl or python ?

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

no programmatic python options? could be nice..

  
  
Posted 3 years ago

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 🙂

  
  
Posted 3 years ago

and then second part is to check if it is up and alive

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago

yes

  
  
Posted 3 years ago