-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
play around with a command-line query script, displaying statistics f…
…rom all nodes.
- Loading branch information
Showing
4 changed files
with
37 additions
and
22 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +0,0 @@ | ||
from lxml.builder import E | ||
from lxml import etree as e | ||
from lxml.etree import XPath | ||
import string as s | ||
|
||
text_list=XPath("//text()") | ||
parser=e.XMLParser(remove_blank_text=True) | ||
|
||
# XML schemata | ||
xsl_job2html_url='http://vamdc.fysast.uu.se:8080/DSAcat/TAP/uws-job-to-html.xsl' | ||
xsl_job2html = e.parse(xsl_job2html_url) | ||
job2html= e.XSLT(xsl_job2html) | ||
|
||
xsl_data2html_url='http://vamdc.fysast.uu.se:8080/DSAcat/TAP/uws-results-to-html.xsl' | ||
xsl_data2html = e.parse(xsl_data2html_url) | ||
data2html= e.XSLT(xsl_data2html) | ||
|
||
xsl_xsams_url='http://vamdc.fysast.uu.se:8080/DSAcat/xsams-0.1.xsd' | ||
xsl_xsams= e.parse(xsl_xsams_url) | ||
|
||
|
||
#import XsamsPyxb as xsams # this requires pyxb to be installed | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import requests | ||
from multiprocessing import Pool | ||
from vamdc.other.registry import getNodeList | ||
|
||
try: | ||
QUERY = sys.argv[1] | ||
except: | ||
print "Please give the complete query string as an argument, in double quotes." | ||
sys.exit(1) | ||
|
||
PARAMS = {\ | ||
'QUERY':QUERY, | ||
'FORMAT':'XSAMS', | ||
'LANG':'VSS2' | ||
} | ||
|
||
def headreq(nodes): | ||
return requests.head(nodes['url']+'sync',params=PARAMS,timeout=5) | ||
|
||
def run(): | ||
nodes = getNodeList() | ||
n = len(nodes) | ||
pool = Pool(processes=n) | ||
|
||
pardict = {'url':[node['url']+'sync' for node in nodes], | ||
'params':(PARAMS,)*n, | ||
'timeout':(5,)*n | ||
} | ||
|
||
res = pool.map(headreq,nodes) | ||
print res | ||
|
||
if __name__ == '__main__': | ||
run() |
File renamed without changes.