def main(): """Makes a series of test calls and prints their outputs.""" port = 80 try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: print("Error: environment variable CONTEXT_ROOT not set.") exit(1) print("Obtaining session token") user = input("Enter username: "******"Enter project: ") password = getpass.getpass(prompt="Enter password: "******"http://localhost:{}{}/WaiterPrep?wsdl".format(port, context_root) print("wsdl URL is {}".format(url)) print("Calling preprocessor with 45 seconds waiting time:") response = soap_call(url, "hpcprepWaiter", [token, extra_pars, 45]) print(response)
def main(): port = 80 try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: print("Error: environment variable CONTEXT_ROOT not set.") exit(1) url = "http://localhost:{}{}/Dialog?wsdl".format(port, context_root) print("wsdl URL is {}".format(url)) print("Obtaining session token") user = input("Enter username: "******"Enter project: ") password = getpass.getpass(prompt="Enter password: "******"Calling startDialog()") response = soap_call(url, "showDialog", ["serviceID1", token, extra_pars]) html = base64.b64decode(response["status_base64"]).decode() with open("test.html", 'w') as fout: fout.write(html) print("Result written to test.html")
def main(): port = 80 try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: print("Error: environment variable CONTEXT_ROOT not set.") exit(1) url = "http://localhost:{}{}/Waiter?wsdl".format(port, context_root) print("wsdl URL is {}".format(url)) if len(sys.argv) != 2: print("Expected [start|status] as argument.") exit(1) print("Obtaining session token") user = input("Enter username: "******"Enter project: ") password = getpass.getpass(prompt="Enter password: ") auth = AuthClient(auth_endpoint) token = auth.get_session_token(user, project, password) if sys.argv[1] == 'start': start(url, token) elif sys.argv[1] == 'status': status(url, token) else: print('Unknown argument.')
def main(): try: port = int(sys.argv[1]) print(f"Using port {port}") except: port = 821 print(f"Couldn't get port from commandline argument, using {port}.") try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: print("Error: environment variable CONTEXT_ROOT not set.") exit(1) # host_adress = 'kafka_consumer' host_adress = '193.175.65.88' url = f"http://{host_adress}:{port}{context_root}/KafkaConsumerService?wsdl" print(f"wsdl URL is {url}") if len(sys.argv) != 2: print("Expected [start|status] as argument.") exit(1) print("Obtaining session token") user = input("Enter username: "******"Enter project: ") password = getpass.getpass(prompt="Enter password: ") auth = AuthClient(auth_endpoint) token = auth.get_session_token(user, project, password) if sys.argv[1] == 'start': start(url, token) elif sys.argv[1] == 'status': status(url, token) else: print('Unknown argument.')
from clfpy import HpcImagesClient from clfpy import GssClient from clfpy import AuthClient auth = AuthClient("https://api.hetcomp.org/authManager/AuthManager?wsdl") user = "******" project = "???" password = "******" print("Authenticating ...") tk = auth.get_session_token(user, project, password) print("Uploading image ...") gss = GssClient("https://api.hetcomp.org/gss-0.1/FileUtilities?wsdl") gss_ID = "it4i_anselm://home/abortable_waiter.simg" # Change to gss.upload for the first upload gss.update(gss_ID, tk, "abortable_waiter.simg") print("Registering image ...") images = HpcImagesClient("https://api.hetcomp.org/hpc-4-anselm/Images?wsdl") # Change to images.upload_image for the first upload images.update_image(tk, "waiter_abortable.simg", gss_ID) print("Querying image information ...") print(images.get_image_info(tk, "waiter_abortable.simg"))
def main(): """Makes a series of test calls and prints their outputs.""" try: host_address_service = int(sys.argv[1]) print(f"Using host address {host_address_service}") except: host_address_service = "localhost" print( "Couldn't get host address of the consumer service from commandline argument, using localhost." ) try: port_service = int(sys.argv[2]) print(f"Using port {port_service}") except: port_service = 821 print( f"Couldn't get port of the consumer service from commandline argument, using {port_service}." ) try: serviceid = int(sys.argv[3]) print(f"Using serviceid {serviceid}") except: serviceid = "testid_" + str(int(time.time())) + "-" + str( random.randint(0, 10000)) print( f"Couldn't get serviceid from commandline argument, using {serviceid}." ) try: host_address = int(sys.argv[4]) print(f"Using host address {host_address}") except: host_address = "92.78.102.187" print( f"Couldn't get kafka broker host address from commandline argument, using default: {host_address}" ) try: port = int(sys.argv[5]) print(f"Using port {port}") except: port = 59092 print( f"Couldn't get port from commandline argument, using default: {port}." ) try: timeout = int(sys.argv[6]) print(f"Using timeout {timeout}") except: timeout = 5 print( f"Couldn't get timeout from commandline argument, using {timeout}s." ) try: topic = int(sys.argv[7]) print(f"Using topic {topic}") except: topic = "testtopic_" + str(random.randint(0, 10000)) print(f"Couldn't get topic from commandline argument, using {topic}.") try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: context_root = '/demo-kafka-consumer' print( f"Error: environment variable CONTEXT_ROOT not set, using default: {context_root}." ) print("Obtaining session token") user = input("Enter username: "******"Enter project: ") password = getpass.getpass(prompt="Enter password: "******"http://{host_address_service}:{port_service}{context_root}/KafkaConsumerService?wsdl" print(f"Service URL is {url}") print("Testing start of consumer:") response = soap_call( url, "startConsumer", [id, token, extra_pars, host_address, port, topic, int(timeout + 5)]) print(f"Start result = {response}") print( f"Waiting {timeout} seconds until update is retrieved and consumer is stopped" ) time.sleep(timeout) response2 = soap_call(url, "getServiceStatus", [id, token]) print(f"status = {response2}") response3 = soap_call(url, "abortService", [id, token]) print(f"Consumer stop successful: {response3}") print(f"Test finished")