Esempio n. 1
0
                    required=True,
                    metavar="<engine_name>")
parser.add_argument('-c',
                    '--cmds',
                    help='WAPL command to run',
                    required=True,
                    metavar="<cmds>")

args = parser.parse_args()

now = datetime.datetime.utcnow().isoformat()

# -----------------------------------------------------
# Intialize the client utility module
# -----------------------------------------------------
conn = waconn.WAConn('waconn.ini', '/twsz/v1/' + args.engineName)

# -----------------------------------------------------
# Query the model and get the js id
# -----------------------------------------------------
resp = conn.textPost('/wapl', text=args.cmds)

r = resp.content
if len(r) == 0:
    print('no response')
    exit(2)

# -----------------------------------------------------
# Print result
# -----------------------------------------------------
# Licensed Materials - Property of HCL*
# (C) Copyright HCL Technologies Ltd. 2017, 2018 All rights reserved.
# * Trademark of HCL Technologies Limited
#############################################################################

import waconn
import argparse

parser = argparse.ArgumentParser(description='Rerun a job')
parser.add_argument('-w','--workstationName', help='TWS workstation name', required=True, metavar="WORKSTATION_NAME")
parser.add_argument('-js','--jsName', help='job stream name', required=True, metavar="JS_NAME")
parser.add_argument('-ia','--schedTime', help='job stream scheduled time / input arrival', metavar="JS_SCHED_TIME")
parser.add_argument('-j','--jobName', help='job name', required=True, metavar="JOB_NAME")

args = parser.parse_args()
conn = waconn.WAConn('waconn.ini','/twsd')

# now we get the job in plan instance

filter = {"filters": {"jobInPlanFilter": {"jobStreamName": args.jsName, "jobName": args.jobName, "workstationName":args.workstationName, "lastInRerunChain": True}}}

if args.schedTime:
    filter["filters"]["jobInPlanFilter"]["inputArrivalTime"]=args.schedTime

print "Running query with filter: " + str(filter)

resp = conn.post('/plan/current/job/query', json=filter, headers={'How-Many': '10'})

r = resp.json()
if len(r) == 0:
    print('No job found')