diff --git a/__init__.py b/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/other/__init__.py b/other/__init__.py index 1e008530..e69de29b 100644 --- a/other/__init__.py +++ b/other/__init__.py @@ -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 diff --git a/other/query_preview.py b/other/query_preview.py new file mode 100755 index 00000000..301adc61 --- /dev/null +++ b/other/query_preview.py @@ -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() diff --git a/portal/query/registry.py b/other/registry.py similarity index 100% rename from portal/query/registry.py rename to other/registry.py