Skip to content

Instantly share code, notes, and snippets.

@cinek810
Created September 8, 2017 02:47
Show Gist options
  • Save cinek810/9c9478f4838d1d6d8d59b5a69ee24839 to your computer and use it in GitHub Desktop.
Save cinek810/9c9478f4838d1d6d8d59b5a69ee24839 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import requests
loadTest= requests.get("https://cmsweb.cern.ch/phedex/datasvc/json/debug/loadteststreams",params={"node":"T2_PL_Warsaw"},verify=False )
import json
print(json.dumps(loadTest.json(),indent=4))
result=loadTest.json()
for loadTest in result["phedex"]["node"][0]["loadtest"]:
node=loadTest["throttle_node"]
dataSet=loadTest["to_dataset"][0]["name"]
PhedexXML="<data version=\"2.0\"><dbs name=\"LoadTest\"><dataset name=\""+dataSet+"\" is-open=\"dummy\"></dataset></dbs></data>"
payload={"data": PhedexXML, "node": node, 'custodial': 'n', 'static':'n', 're-evaluate':'n', 'move': 'n', 'priority': 'normal', 'group': 'FacOps', 'request_only': 'y', 'no_mail': 'y', 'level': 'bl
ock'}
#print payload
r=requests.post("https://cmsweb.cern.ch/phedex/datasvc/json/debug/subscribe",data=payload,verify=False,cert=('/home/cinek/.globus/usercert.pem','/home/cinek/.globus/userkey.pem'))
print r.text
print(node+" "+dataSet)
#break
#print node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment