ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
AtlCoolConsole.AtlCoolConsole Class Reference
Inheritance diagram for AtlCoolConsole.AtlCoolConsole:
Collaboration diagram for AtlCoolConsole.AtlCoolConsole:

Public Member Functions

def __init__ (self, connectString=None)
 
def interact (self)
 
def parseLine (self, line)
 
def createInterpreterCommand (self, command, argumentString)
 
def command_less (self, argumentString)
 
def command_more (self, argumentString)
 
def command_ls (self, argumentString, doCount=False)
 
def command_pwd (self)
 
def command_pws (self)
 
def command_lstags (self, argumentString)
 
def command_filtertags (self, argumentString)
 
def command_listchans (self, argumentString)
 
def command_listinfo (self, argumentString)
 
def command_rmdir (self, argumentString)
 
def command_usetag (self, argumentString)
 
def command_usechan (self, argumentString)
 
def command_cd (self, argumentString)
 
def command_settag (self, argumentString)
 
def command_settginfo (self, argumentString)
 
def command_setchan (self, argumentString)
 
def command_userunlumi (self, argumentString)
 
def command_usetimes (self, argumentString)
 
def command_clonetag (self, argumentString)
 
def command_rmtag (self, argumentString)
 
def command_locktag (self, argumentString)
 
def command_headtag (self, argumentString)
 
def command_tracetags (self, argumentString)
 
def command_setdesc (self, argumentString)
 
def command_help (self, argumentString)
 
def command_exit (self)
 
def command_open (self, argumentString)
 
def push (self, line)
 
def init_history (self, histfile)
 
def save_history (self, histfile)
 

Public Attributes

 connectString
 

Static Public Attributes

dictionary commands
 
string banner = "Welcome to AtlCoolConsole. Type 'help' for instructions."
 

Detailed Description

Definition at line 54 of file AtlCoolConsole.py.

Constructor & Destructor Documentation

◆ __init__()

def AtlCoolConsole.AtlCoolConsole.__init__ (   self,
  connectString = None 
)

Definition at line 90 of file AtlCoolConsole.py.

90  def __init__( self, connectString = None ):
91  HistoryConsole.__init__( self )
92  self.connectString = connectString
93 
94 

Member Function Documentation

◆ command_cd()

def AtlCoolConsole.AtlCoolConsole.command_cd (   self,
  argumentString 
)

Definition at line 279 of file AtlCoolConsole.py.

279  def command_cd( self, argumentString ):
280  if argumentString is None: argumentString ='/'
281  argumentString.strip()
282  if argumentString == '': argumentString = '/'
283  cmds=[]
284  cmds.append('this.cd("%s")' % argumentString)
285  return ';'.join( cmds )
286 

◆ command_clonetag()

def AtlCoolConsole.AtlCoolConsole.command_clonetag (   self,
  argumentString 
)

Definition at line 332 of file AtlCoolConsole.py.

332  def command_clonetag(self,argumentString):
333  args=argumentString.split()
334  if len(args)<3:
335  print ('Usage: clonetag <folder> <sourcetag> <desttag>')
336  return ''
337  cmds=[]
338  cmds.append('this.clonetag("%s")' % argumentString)
339  return ';'.join(cmds)
340 
341 

◆ command_exit()

def AtlCoolConsole.AtlCoolConsole.command_exit (   self)

Definition at line 409 of file AtlCoolConsole.py.

409  def command_exit( self ):
410  return 'import sys ; sys.exit(0)'
411 
412 

◆ command_filtertags()

def AtlCoolConsole.AtlCoolConsole.command_filtertags (   self,
  argumentString 
)

Definition at line 227 of file AtlCoolConsole.py.

227  def command_filtertags(self,argumentString):
228  if argumentString is None or argumentString=="": argumentString = '.'
229  argumentString.strip()
230  if argumentString is None: argumentString = '.'
231  args = argumentString.split()
232  node=args[0]
233  pattern=""
234  if len(args)>1:
235  pattern=args[1]
236  cmds = []
237  cmds.append('this.lstags("%s",pattern="%s")' % (node,pattern))
238  return ';'.join(cmds)
239 
240 

◆ command_headtag()

def AtlCoolConsole.AtlCoolConsole.command_headtag (   self,
  argumentString 
)

Definition at line 360 of file AtlCoolConsole.py.

360  def command_headtag(self,argumentString):
361  args=argumentString.split()
362  if len(args)<2:
363  print ('Usage: headtag <folder> <tag>')
364  return ''
365  cmds=[]
366  cmds.append('this.headtag("%s")' % argumentString)
367  return ';'.join(cmds)
368 
369 

◆ command_help()

def AtlCoolConsole.AtlCoolConsole.command_help (   self,
  argumentString 
)

Definition at line 390 of file AtlCoolConsole.py.

390  def command_help( self, argumentString ):
391  if argumentString is not None and argumentString != '':
392  # we have a python "help(...)" command most likely
393  # we only want to intercept "help", therefore return the original
394  return 'help ' + argumentString
395  print ('Available commands:')
396  keys = list(self.commands.keys())
397  keys.sort()
398  for key in keys:
399  print (' %(key)-8s : %(value)s' % { 'key' : key,
400  'value' : self.commands[key] })
401  print ("These commands are shortcuts that are forwarded to a CoolTool")
402  print ("instance 'this', referring to the currently connected database.")
403  print ("Since this environment is a fully functional python shell,")
404  print ("'this' can be used like any python object, e.g.:")
405  print (" this.ls( '/' )")
406  return ''
407 
408 

◆ command_less()

def AtlCoolConsole.AtlCoolConsole.command_less (   self,
  argumentString 
)

Definition at line 178 of file AtlCoolConsole.py.

178  def command_less( self, argumentString ):
179  if argumentString is None:
180  raise Exception( "usage: less <folder>" )
181  argumentString.strip()
182  nodes = argumentString.split()
183  cmds = []
184  for node in nodes:
185  cmds.append( 'this.less("%s", header=True)' % node )
186  return ';'.join( cmds )
187 

◆ command_listchans()

def AtlCoolConsole.AtlCoolConsole.command_listchans (   self,
  argumentString 
)

Definition at line 241 of file AtlCoolConsole.py.

241  def command_listchans( self, argumentString ):
242  if argumentString is None: argumentString = '.'
243  argumentString.strip()
244  if argumentString is None: argumentString = '.'
245  nodes = argumentString.split()
246  cmds = []
247  for node in nodes:
248  cmds.append( 'this.listchans("%s")' % node )
249  return ';'.join( cmds )
250 

◆ command_listinfo()

def AtlCoolConsole.AtlCoolConsole.command_listinfo (   self,
  argumentString 
)

Definition at line 251 of file AtlCoolConsole.py.

251  def command_listinfo( self, argumentString ):
252  if argumentString is None: argumentString = '.'
253  argumentString.strip()
254  if argumentString is None: argumentString = '.'
255  nodes = argumentString.split()
256  cmds = []
257  for node in nodes:
258  cmds.append( 'this.listinfo("%s")' % node )
259  return ';'.join( cmds )
260 

◆ command_locktag()

def AtlCoolConsole.AtlCoolConsole.command_locktag (   self,
  argumentString 
)

Definition at line 351 of file AtlCoolConsole.py.

351  def command_locktag(self,argumentString):
352  args=argumentString.split()
353  if len(args)<2:
354  print ('Usage: locktag <folder> <tag> {action=l|p|u|r}')
355  return ''
356  cmds=[]
357  cmds.append('this.locktag("%s")' % argumentString)
358  return ';'.join(cmds)
359 

◆ command_ls()

def AtlCoolConsole.AtlCoolConsole.command_ls (   self,
  argumentString,
  doCount = False 
)

Definition at line 199 of file AtlCoolConsole.py.

199  def command_ls( self, argumentString, doCount=False ):
200  if argumentString is None: argumentString = '.'
201  argumentString.strip()
202  if argumentString == '': argumentString = '.'
203  nodes = argumentString.split()
204  cmds = []
205  tof='False'
206  if (doCount): tof='True'
207  for node in nodes:
208  cmds.append( 'this.ls("%s", header=True, doCount=%s)' % (node,tof) )
209  return ';'.join( cmds )
210 

◆ command_lstags()

def AtlCoolConsole.AtlCoolConsole.command_lstags (   self,
  argumentString 
)

Definition at line 217 of file AtlCoolConsole.py.

217  def command_lstags( self, argumentString ):
218  if argumentString is None: argumentString = '.'
219  argumentString.strip()
220  if argumentString is None: argumentString = '.'
221  nodes = argumentString.split()
222  cmds = []
223  for node in nodes:
224  cmds.append( 'this.lstags("%s")' % node )
225  return ';'.join( cmds )
226 

◆ command_more()

def AtlCoolConsole.AtlCoolConsole.command_more (   self,
  argumentString 
)

Definition at line 188 of file AtlCoolConsole.py.

188  def command_more( self, argumentString ):
189  if argumentString is None:
190  raise Exception( "usage: more <folder>" )
191  argumentString.strip()
192  nodes = argumentString.split()
193  cmds = []
194  for node in nodes:
195  cmds.append( 'this.more("%s", header=True)' % node )
196  return ';'.join( cmds )
197 
198 

◆ command_open()

def AtlCoolConsole.AtlCoolConsole.command_open (   self,
  argumentString 
)

Definition at line 413 of file AtlCoolConsole.py.

413  def command_open( self, argumentString ):
414  log.debug( 'argumentString: ' + argumentString )
415  if ( not argumentString.startswith('"') and
416  not argumentString.startswith("'") ):
417  argumentString = "'" + argumentString + "'"
418  log.debug( 'argumentString: ' + argumentString )
419  return 'this = AtlCoolTool.AtlCoolTool(%s)' % argumentString
420 
421 

◆ command_pwd()

def AtlCoolConsole.AtlCoolConsole.command_pwd (   self)

Definition at line 211 of file AtlCoolConsole.py.

211  def command_pwd(self):
212  return ';'.join(['this.pwd()'])
213 

◆ command_pws()

def AtlCoolConsole.AtlCoolConsole.command_pws (   self)

Definition at line 214 of file AtlCoolConsole.py.

214  def command_pws(self):
215  return ';'.join(['this.pws()'])
216 

◆ command_rmdir()

def AtlCoolConsole.AtlCoolConsole.command_rmdir (   self,
  argumentString 
)

Definition at line 261 of file AtlCoolConsole.py.

261  def command_rmdir(self, argumentString ):
262  argumentString.strip()
263  cmds=[]
264  cmds.append('this.rmdir("%s")' % argumentString)
265  return ';'.join( cmds )
266 

◆ command_rmtag()

def AtlCoolConsole.AtlCoolConsole.command_rmtag (   self,
  argumentString 
)

Definition at line 342 of file AtlCoolConsole.py.

342  def command_rmtag(self,argumentString):
343  args=argumentString.split()
344  if len(args)<2:
345  print ('Usage: rmtag <folder> <leaf or parent tag>')
346  return ''
347  cmds=[]
348  cmds.append('this.rmtag("%s")' % argumentString)
349  return ';'.join(cmds)
350 

◆ command_setchan()

def AtlCoolConsole.AtlCoolConsole.command_setchan (   self,
  argumentString 
)

Definition at line 305 of file AtlCoolConsole.py.

305  def command_setchan(self,argumentString):
306  args=argumentString.split()
307  if len(args)<3:
308  print ('Usage: setchan <folder> <chanID> <chanName> {<chanDescr>}')
309  return ''
310  cmds=[]
311  cmds.append('this.setchan("%s")' % argumentString)
312  return ';'.join(cmds)
313 

◆ command_setdesc()

def AtlCoolConsole.AtlCoolConsole.command_setdesc (   self,
  argumentString 
)

Definition at line 380 of file AtlCoolConsole.py.

380  def command_setdesc( self, argumentString ):
381  args=argumentString.split()
382  if len(args)<1:
383  print ('Usage: setdesc <folder> {<newdesc>}')
384  return ''
385  cmds=[]
386  cmds.append('this.setdesc("%s")' % argumentString)
387  return ';'.join(cmds)
388 
389 

◆ command_settag()

def AtlCoolConsole.AtlCoolConsole.command_settag (   self,
  argumentString 
)

Definition at line 287 of file AtlCoolConsole.py.

287  def command_settag(self,argumentString):
288  args=argumentString.split()
289  if len(args)<3:
290  print ('Usage: settag <folder> <foldertag> <parenttag>')
291  return ''
292  cmds=[]
293  cmds.append('this.settag("%s")' % argumentString)
294  return ';'.join(cmds)
295 

◆ command_settginfo()

def AtlCoolConsole.AtlCoolConsole.command_settginfo (   self,
  argumentString 
)

Definition at line 296 of file AtlCoolConsole.py.

296  def command_settginfo(self,argumentString):
297  args=argumentString.split()
298  if len(args)<2:
299  print ('Usage: settginfo <folder> <tag> <description>')
300  return ''
301  cmds=[]
302  cmds.append('this.settginfo("%s")' % argumentString)
303  return ';'.join(cmds)
304 

◆ command_tracetags()

def AtlCoolConsole.AtlCoolConsole.command_tracetags (   self,
  argumentString 
)

Definition at line 370 of file AtlCoolConsole.py.

370  def command_tracetags(self,argumentString):
371  args=argumentString.split()
372  if len(args)<2:
373  print ('Usage: tracetags <folder> <foldertag>')
374  return ''
375  cmds=[]
376  cmds.append('this.tracetags("%s")' % argumentString)
377  return ';'.join(cmds)
378 
379 

◆ command_usechan()

def AtlCoolConsole.AtlCoolConsole.command_usechan (   self,
  argumentString 
)

Definition at line 273 of file AtlCoolConsole.py.

273  def command_usechan(self, argumentString ):
274  argumentString.strip()
275  cmds=[]
276  cmds.append('this.usechan("%s")' % argumentString)
277  return ';'.join( cmds )
278 

◆ command_userunlumi()

def AtlCoolConsole.AtlCoolConsole.command_userunlumi (   self,
  argumentString 
)

Definition at line 314 of file AtlCoolConsole.py.

314  def command_userunlumi(self,argumentString):
315  args=argumentString.split()
316  if len(args)!=1 and len(args)<4:
317  print ('Usage: userunlumi <run1> {<LB1> <run2> <LB2>}')
318  return ''
319  cmds=[]
320  cmds.append('this.userunlumi("%s")' % argumentString)
321  return ';'.join(cmds)
322 

◆ command_usetag()

def AtlCoolConsole.AtlCoolConsole.command_usetag (   self,
  argumentString 
)

Definition at line 267 of file AtlCoolConsole.py.

267  def command_usetag(self, argumentString ):
268  argumentString.strip()
269  cmds=[]
270  cmds.append('this.usetag("%s")' % argumentString)
271  return ';'.join( cmds )
272 

◆ command_usetimes()

def AtlCoolConsole.AtlCoolConsole.command_usetimes (   self,
  argumentString 
)

Definition at line 323 of file AtlCoolConsole.py.

323  def command_usetimes(self,argumentString):
324  args=argumentString.split()
325  if len(args)<2:
326  print ('Usage: usetimes <time1> <time2>')
327  return ''
328  cmds=[]
329  cmds.append('this.usetimes("%s")' % argumentString)
330  return ';'.join(cmds)
331 

◆ createInterpreterCommand()

def AtlCoolConsole.AtlCoolConsole.createInterpreterCommand (   self,
  command,
  argumentString 
)

Definition at line 115 of file AtlCoolConsole.py.

115  def createInterpreterCommand( self, command, argumentString ):
116  if command == 'less':
117  return self.command_less( argumentString )
118  elif command == 'more':
119  return self.command_more( argumentString )
120  elif command == 'ls':
121  return self.command_ls( argumentString,False )
122  elif command == 'll':
123  return self.command_ls( argumentString,True )
124  elif command == 'help':
125  return self.command_help( argumentString )
126  elif command == 'exit':
127  return self.command_exit()
128  elif command == 'quit':
129  return self.command_exit()
130  elif command == 'open':
131  return self.command_open( argumentString )
132  elif command =='listtags':
133  return self.command_lstags( argumentString )
134  elif command =='filtertags':
135  return self.command_filtertags( argumentString )
136  elif command =='listchans':
137  return self.command_listchans( argumentString )
138  elif command =='listinfo':
139  return self.command_listinfo( argumentString )
140  elif command =='rmdir':
141  return self.command_rmdir( argumentString )
142  elif command =='usetag':
143  return self.command_usetag( argumentString )
144  elif command =='usechan':
145  return self.command_usechan( argumentString )
146  elif command =='settag':
147  return self.command_settag( argumentString )
148  elif command =='settginfo':
149  return self.command_settginfo( argumentString )
150  elif command =='setchan':
151  return self.command_setchan( argumentString )
152  elif command =='userunlumi':
153  return self.command_userunlumi( argumentString )
154  elif command =='usetimes':
155  return self.command_usetimes( argumentString )
156  elif command =='clonetag':
157  return self.command_clonetag( argumentString )
158  elif command =='rmtag':
159  return self.command_rmtag( argumentString )
160  elif command =='locktag':
161  return self.command_locktag( argumentString )
162  elif command =='headtag':
163  return self.command_headtag( argumentString )
164  elif command =='tracetags':
165  return self.command_tracetags( argumentString )
166  elif command == 'setdesc':
167  return self.command_setdesc( argumentString )
168  elif command =='cd':
169  return self.command_cd( argumentString )
170  elif command =='pwd':
171  return self.command_pwd()
172  elif command =='pws':
173  return self.command_pws()
174  else:
175  return None
176 
177 

◆ init_history()

def AtlCoolConsole.HistoryConsole.init_history (   self,
  histfile 
)
inherited

Definition at line 39 of file AtlCoolConsole.py.

39  def init_history( self, histfile ):
40  readline.parse_and_bind( "tab: complete" )
41  readline.set_history_length( 100 )
42  if hasattr( readline, "read_history_file" ):
43  try:
44  readline.read_history_file( histfile )
45  except IOError:
46  pass
47  atexit.register( self.save_history, histfile )
48 

◆ interact()

def AtlCoolConsole.AtlCoolConsole.interact (   self)

Definition at line 95 of file AtlCoolConsole.py.

95  def interact( self ):
96  self.push( 'from CoolConvUtilities import AtlCoolTool' )
97  if connectString is not None:
98  self.push( 'this = AtlCoolTool.AtlCoolTool("%s")' % self.connectString )
99  self.push( 'print (this)' )
100  else:
101  print ( "Not connected. Use the 'open' command to connect to "
102  "a database." )
103  HistoryConsole.interact( self, self.banner )
104 
105 

◆ parseLine()

def AtlCoolConsole.AtlCoolConsole.parseLine (   self,
  line 
)

Definition at line 106 of file AtlCoolConsole.py.

106  def parseLine( self, line ):
107  for command in self.commands.keys():
108  #res = re.search( '^' + command + '\s*(?P<remainder>.*)', line )
109  res=re.search( '^' + command + r'($|\s+(?P<remainder>.*))', line )
110  if res is not None:
111  return command, res.group('remainder') or ""
112  return None, line
113 
114 

◆ push()

def AtlCoolConsole.AtlCoolConsole.push (   self,
  line 
)

Definition at line 422 of file AtlCoolConsole.py.

422  def push(self, line):
423  command, remainder = self.parseLine( line )
424  log.debug( 'command: %s' % command )
425  log.debug( 'remainder: %s' % remainder )
426 
427  res = self.createInterpreterCommand( command, remainder )
428  if res is not None:
429  log.debug( 'command: "%s"' % res )
430  interpreterCommand = res
431  else:
432  interpreterCommand = line
433 
434  #HistoryConsole.push( self, 'print "cmd: %s"' % interpreterCommand )
435  return HistoryConsole.push( self, interpreterCommand )
436 
437 
438 
439 

◆ save_history()

def AtlCoolConsole.HistoryConsole.save_history (   self,
  histfile 
)
inherited

Definition at line 49 of file AtlCoolConsole.py.

49  def save_history( self, histfile ):
50  readline.write_history_file( histfile )
51 
52 
53 

Member Data Documentation

◆ banner

string AtlCoolConsole.AtlCoolConsole.banner = "Welcome to AtlCoolConsole. Type 'help' for instructions."
static

Definition at line 88 of file AtlCoolConsole.py.

◆ commands

dictionary AtlCoolConsole.AtlCoolConsole.commands
static

Definition at line 56 of file AtlCoolConsole.py.

◆ connectString

AtlCoolConsole.AtlCoolConsole.connectString

Definition at line 92 of file AtlCoolConsole.py.


The documentation for this class was generated from the following file:
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798