72def getFullTaskNames(taskman,dsname,taskname,requireSingleTask=False,confirmWithUser=False,addWildCards=True):
73 """Retrieve the full dataset and task names given a pair of (dsname,task) that may
74 contain wildcards or be just a parital name such as the run number. Depending
75 on the requireSingleTask and confirmWithUser settings a TaskManagerCheckError
76 is raised if there are multiple tasks or if the user doesn't confirm."""
77 taskList = taskman.getTaskNames(dsname,taskname,addWildCards)
78 if len(taskList)==0:
79 raise TaskManagerCheckError ('ERROR: No tasks found for dataset = %s, task = %s' % (dsname,taskname))
80 if requireSingleTask and len(taskList)!=1:
81 m = "ERROR: Multiple data set names found for dataset = %s, task = %s\n Please use full dataset or task name from list below, using option -n if necessary:\n\n" % (dsname,taskname)
82 m += " %-50s %s\n" % ('DATASET NAME','TASK NAME')
83 m += " %s\n" % (75*'-')
84 for t in taskList:
85 m += " %-50s %s\n" % (t[0],t[1])
86 m += '\n'
87 raise TaskManagerCheckError (m)
88 if confirmWithUser:
89 print ('Please confirm that you want to execute this command for the following tasks:\n')
90 print (" %-50s %s" % ('DATASET NAME','TASK NAME'))
91 print (" %s" % (75*'-'))
92 for t in taskList:
93 print (" %-50s %s" % (t[0],t[1]))
94 a = input('\nARE YOU SURE [n] ? ')
95 if a!='y':
96 raise TaskManagerCheckError ('ERROR: Aborted by user')
98 return taskList
99
100
void print(char *figname, TCanvas *c1)