All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
python.projectapp.ProjectApp Class Reference
Inheritance diagram for python.projectapp.ProjectApp:

Public Member Functions

def __init__
 
def make_widgets
 
def often
 
def make_menubar
 
def open
 
def choose_project
 
def choose_stage
 
def next_project_handler
 
def previous_project_handler
 
def next_stage_handler
 
def previous_stage_handler
 
def next_project
 
def previous_project
 
def xml_display
 
def next_stage
 
def previous_stage
 
def check
 
def checkana
 
def fetchlog
 
def shorten
 
def clean
 
def submit
 
def makeup
 
def update_jobs
 
def kill_jobs
 
def mergehist
 
def mergentuple
 
def merge
 
def declare
 
def declare_ana
 
def check_declarations
 
def check_ana_declarations
 
def test_declarations
 
def test_ana_declarations
 
def define
 
def define_ana
 
def check_definition
 
def check_ana_definition
 
def test_definition
 
def test_ana_definition
 
def check_locations
 
def check_ana_locations
 
def check_tape
 
def check_ana_tape
 
def add_locations
 
def add_ana_locations
 
def clean_locations
 
def clean_ana_locations
 
def remove_locations
 
def remove_ana_locations
 
def upload
 
def upload_ana
 
def audit
 
def help
 
def xmlhelp
 
def close
 

Public Attributes

 root
 
 current_project_name
 
 current_project_defs
 
 current_project_def
 
 current_stage_name
 
 current_stage_def
 
 projects
 
 project_view
 
 console
 
 menubar
 
 project_menu
 
 stage_menu
 
 output_menu
 
 batch_menu
 
 sam_menu
 
 help_menu
 

Detailed Description

Definition at line 47 of file projectapp.py.

Constructor & Destructor Documentation

def python.projectapp.ProjectApp.__init__ (   self,
  parent = None 
)

Definition at line 51 of file projectapp.py.

51 
52  def __init__(self, parent=None):
53 
54  # Root window.
55 
56  if parent == None:
57  self.root = tk.Tk()
58  else:
59  self.root = parent
60  self.root.title('project')
61  self.root.protocol('WM_DELETE_WINDOW', self.close)
62 
63  # Register our outermost frame in the parent window.
64 
65  tk.Frame.__init__(self, self.root)
66  self.pack(expand=1, fill=tk.BOTH)
67 
68  # Make widgets that belong to this app.
69 
70  self.make_widgets()
71 
72  # Current project and stage (menu settable).
73 
76  self.current_project_def = None
78  self.current_stage_def = None
79 
80  # Known projects (3-tuple: project_name, xml_path, project_defs)
81 
82  self.projects = []
83 
84  # Process command line arguments.
85 
86  for n in range(1, len(sys.argv)):
87  xmlpath = sys.argv[n]
88  self.open(xmlpath, choose=False)
89  if len(self.projects) > 0:
90  self.choose_project(self.projects[0][0])

Member Function Documentation

def python.projectapp.ProjectApp.add_ana_locations (   self)

Definition at line 1070 of file projectapp.py.

1071  def add_ana_locations(self):
1072  self.add_locations(ana=True)
def python.projectapp.ProjectApp.add_locations (   self,
  ana = False 
)

Definition at line 1041 of file projectapp.py.

1042  def add_locations(self, ana=False):
1043  if self.current_project_def == None:
1044  tkinter_messagebox.showwarning('', 'No project selected.')
1045  return
1046  if self.current_stage_def == None:
1047  tkinter_messagebox.showwarning('', 'No stage selected.')
1048  return
1049  top=self.winfo_toplevel()
1050  old_cursor = top['cursor']
1051  try:
1052  top['cursor'] = 'watch'
1053  top.update_idletasks()
1054  dim = project_utilities.dimensions_datastream(self.current_project_def,
1055  self.current_stage_def,
1056  ana=ana)
1057  project.docheck_locations(dim, self.current_stage_def.outdir,
1058  add=True,
1059  clean=False,
1060  remove=False,
1061  upload=False)
1062  top['cursor'] = old_cursor
1063  except:
1064  top['cursor'] = old_cursor
1065  e = sys.exc_info()
1066  traceback.print_tb(e[2])
1067  tkinter_messagebox.showerror('', e[1])
def docheck_locations
Definition: project.py:2265
def python.projectapp.ProjectApp.audit (   self)

Definition at line 1177 of file projectapp.py.

1178  def audit(self):
1179  if self.current_project_def == None:
1180  tkinter_messagebox.showwarning('', 'No project selected.')
1181  return
1182  if self.current_stage_def == None:
1183  tkinter_messagebox.showwarning('', 'No stage selected.')
1184  return
1185  top=self.winfo_toplevel()
1186  old_cursor = top['cursor']
1187  try:
1188  top['cursor'] = 'watch'
1189  top.update_idletasks()
1191  top['cursor'] = old_cursor
1192  except:
1193  top['cursor'] = old_cursor
1194  e = sys.exc_info()
1195  traceback.print_tb(e[2])
1196  tkinter_messagebox.showerror('', e[1])
def doaudit
Definition: project.py:3778
def python.projectapp.ProjectApp.check (   self)

Definition at line 473 of file projectapp.py.

474  def check(self):
475  if self.current_project_def == None:
476  tkinter_messagebox.showwarning('', 'No project selected.')
477  return
478  if self.current_stage_def == None:
479  tkinter_messagebox.showwarning('', 'No stage selected.')
480  return
481  top=self.winfo_toplevel()
482  old_cursor = top['cursor']
483  try:
484  top['cursor'] = 'watch'
485  top.update_idletasks()
487  quick=self.current_stage_def.validate_on_worker)
488  top['cursor'] = old_cursor
489  except:
490  top['cursor'] = old_cursor
491  e = sys.exc_info()
492  traceback.print_tb(e[2])
493  tkinter_messagebox.showerror('', e[1])
494  self.project_view.update_status()
def docheck
Definition: project.py:1087
def python.projectapp.ProjectApp.check_ana_declarations (   self)

Definition at line 831 of file projectapp.py.

832  def check_ana_declarations(self):
833  self.check_declarations(ana=True)
def python.projectapp.ProjectApp.check_ana_definition (   self)

Definition at line 935 of file projectapp.py.

936  def check_ana_definition(self):
937  self.check_definition(ana=True)
def python.projectapp.ProjectApp.check_ana_locations (   self)

Definition at line 1006 of file projectapp.py.

1007  def check_ana_locations(self):
1008  self.check_locations(ana=True)
def python.projectapp.ProjectApp.check_ana_tape (   self)

Definition at line 1036 of file projectapp.py.

1037  def check_ana_tape(self):
1038  self.check_tape(ana=True)
def python.projectapp.ProjectApp.check_declarations (   self,
  ana = False 
)

Definition at line 808 of file projectapp.py.

809  def check_declarations(self, ana=False):
810  if self.current_project_def == None:
811  tkinter_messagebox.showwarning('', 'No project selected.')
812  return
813  if self.current_stage_def == None:
814  tkinter_messagebox.showwarning('', 'No stage selected.')
815  return
816  top=self.winfo_toplevel()
817  old_cursor = top['cursor']
818  try:
819  top['cursor'] = 'watch'
820  top.update_idletasks()
821  project.docheck_declarations(self.current_stage_def.logdir,
822  self.current_stage_def.outdir, declare=False, ana=ana)
823  top['cursor'] = old_cursor
824  except:
825  top['cursor'] = old_cursor
826  e = sys.exc_info()
827  traceback.print_tb(e[2])
828  tkinter_messagebox.showerror('', e[1])
def docheck_declarations
Definition: project.py:2071
def python.projectapp.ProjectApp.check_definition (   self,
  ana = False 
)

Definition at line 903 of file projectapp.py.

904  def check_definition(self, ana=False):
905  if self.current_project_def == None:
906  tkinter_messagebox.showwarning('', 'No project selected.')
907  return
908  if self.current_stage_def == None:
909  tkinter_messagebox.showwarning('', 'No stage selected.')
910  return
911  top=self.winfo_toplevel()
912  old_cursor = top['cursor']
913 
914  defname = ''
915  if ana:
916  defname = self.current_stage_def.ana_defname
917  else:
918  defname = self.current_stage_def.defname
919 
920  try:
921  top['cursor'] = 'watch'
922  top.update_idletasks()
923  dim = project_utilities.dimensions_datastream(self.current_project_def,
924  self.current_stage_def,
925  ana=ana)
926  project.docheck_definition(defname, dim, define=False)
927  top['cursor'] = old_cursor
928  except:
929  top['cursor'] = old_cursor
930  e = sys.exc_info()
931  traceback.print_tb(e[2])
932  tkinter_messagebox.showerror('', e[1])
def docheck_definition
Definition: project.py:2176
def python.projectapp.ProjectApp.check_locations (   self,
  ana = False 
)

Definition at line 977 of file projectapp.py.

978  def check_locations(self, ana=False):
979  if self.current_project_def == None:
980  tkinter_messagebox.showwarning('', 'No project selected.')
981  return
982  if self.current_stage_def == None:
983  tkinter_messagebox.showwarning('', 'No stage selected.')
984  return
985  top=self.winfo_toplevel()
986  old_cursor = top['cursor']
987  try:
988  top['cursor'] = 'watch'
989  top.update_idletasks()
990  dim = project_utilities.dimensions_datastream(self.current_project_def,
991  self.current_stage_def,
992  ana=ana)
993  project.docheck_locations(dim, self.current_stage_def.logdir,
994  add=False,
995  clean=False,
996  remove=False,
997  upload=False)
998  top['cursor'] = old_cursor
999  except:
1000  top['cursor'] = old_cursor
1001  e = sys.exc_info()
1002  traceback.print_tb(e[2])
1003  tkinter_messagebox.showerror('', e[1])
def docheck_locations
Definition: project.py:2265
def python.projectapp.ProjectApp.check_tape (   self,
  ana = False 
)

Definition at line 1011 of file projectapp.py.

1012  def check_tape(self, ana=False):
1013  if self.current_project_def == None:
1014  tkinter_messagebox.showwarning('', 'No project selected.')
1015  return
1016  if self.current_stage_def == None:
1017  tkinter_messagebox.showwarning('', 'No stage selected.')
1018  return
1019  top=self.winfo_toplevel()
1020  old_cursor = top['cursor']
1021  try:
1022  top['cursor'] = 'watch'
1023  top.update_idletasks()
1024  dim = project_utilities.dimensions_datastream(self.current_project_def,
1025  self.current_stage_def,
1026  ana=ana)
1028  top['cursor'] = old_cursor
1029  except:
1030  top['cursor'] = old_cursor
1031  e = sys.exc_info()
1032  traceback.print_tb(e[2])
1033  tkinter_messagebox.showerror('', e[1])
def docheck_tape
Definition: project.py:2432
def python.projectapp.ProjectApp.checkana (   self)

Definition at line 497 of file projectapp.py.

498  def checkana(self):
499  if self.current_project_def == None:
500  tkinter_messagebox.showwarning('', 'No project selected.')
501  return
502  if self.current_stage_def == None:
503  tkinter_messagebox.showwarning('', 'No stage selected.')
504  return
505  top=self.winfo_toplevel()
506  old_cursor = top['cursor']
507  try:
508  top['cursor'] = 'watch'
509  top.update_idletasks()
511  top['cursor'] = old_cursor
512  except:
513  top['cursor'] = old_cursor
514  e = sys.exc_info()
515  traceback.print_tb(e[2])
516  tkinter_messagebox.showerror('', e[1])
517  self.project_view.update_status()
def docheck
Definition: project.py:1087
def python.projectapp.ProjectApp.choose_project (   self,
  value 
)

Definition at line 344 of file projectapp.py.

345  def choose_project(self, value):
346  self.current_project_name = ''
347  self.current_project_defs = []
348  self.current_project_def = None
349  self.current_stage_name = ''
350  self.current_stage_def = None
351  self.project_view.highlight_stage(self.current_stage_name)
352  for project_tuple in self.projects:
353  project_name = project_tuple[0]
354  xml_path = project_tuple[1]
355  project_defs = project_tuple[2]
356  if project_name == value:
357  self.current_project_name = value
358  self.current_project_defs = project_defs
359 
360  # Update project view widget.
361 
362  self.project_view.set_project(project_name, xml_path, project_defs)
363 
364  # Update stage menu.
365 
366  self.stage_menu.delete(3, tk.END)
367  self.stage_menu.add_separator()
368  for project_def in project_defs:
369  for stage in project_def.stages:
370  callback = tk._setit(tk.StringVar(), stage.name, callback=self.choose_stage)
371  self.stage_menu.add_command(label=stage.name, command=callback)
372 
373  return
374 
375  # It is an error if we fall out of the loop.
376 
377  raise 'No project: %s' % value
def python.projectapp.ProjectApp.choose_stage (   self,
  value 
)

Definition at line 380 of file projectapp.py.

381  def choose_stage(self, value):
382  for project_def in self.current_project_defs:
383  for stage in project_def.stages:
384  if stage.name == value:
385  self.current_stage_name = value
386  self.current_stage_def = stage
387  self.current_project_def = project_def
388  self.project_view.highlight_stage(self.current_stage_name)
def python.projectapp.ProjectApp.clean (   self)

Definition at line 565 of file projectapp.py.

566  def clean(self):
567  if self.current_project_def == None:
568  tkinter_messagebox.showwarning('', 'No project selected.')
569  return
570  if self.current_stage_def == None:
571  tkinter_messagebox.showwarning('', 'No stage selected.')
572  return
573  top=self.winfo_toplevel()
574  old_cursor = top['cursor']
575  try:
576  top['cursor'] = 'watch'
577  top.update_idletasks()
578  project.docleanx(self.current_project_defs, self.current_project_def.name,
579  self.current_stage_name)
580  top['cursor'] = old_cursor
581  except:
582  top['cursor'] = old_cursor
583  e = sys.exc_info()
584  traceback.print_tb(e[2])
585  tkinter_messagebox.showerror('', e[1])
586  self.project_view.update_status()
def docleanx
Definition: project.py:519
def python.projectapp.ProjectApp.clean_ana_locations (   self)

Definition at line 1104 of file projectapp.py.

1105  def clean_ana_locations(self):
1106  self.clean_locations(ana=True)
def python.projectapp.ProjectApp.clean_locations (   self,
  ana 
)

Definition at line 1075 of file projectapp.py.

1076  def clean_locations(self, ana):
1077  if self.current_project_def == None:
1078  tkinter_messagebox.showwarning('', 'No project selected.')
1079  return
1080  if self.current_stage_def == None:
1081  tkinter_messagebox.showwarning('', 'No stage selected.')
1082  return
1083  top=self.winfo_toplevel()
1084  old_cursor = top['cursor']
1085  try:
1086  top['cursor'] = 'watch'
1087  top.update_idletasks()
1088  dim = project_utilities.dimensions_datastream(self.current_project_def,
1089  self.current_stage_def,
1090  ana=ana)
1091  project.docheck_locations(dim, self.current_stage_def.outdir,
1092  add=False,
1093  clean=True,
1094  remove=False,
1095  upload=False)
1096  top['cursor'] = old_cursor
1097  except:
1098  top['cursor'] = old_cursor
1099  e = sys.exc_info()
1100  traceback.print_tb(e[2])
1101  tkinter_messagebox.showerror('', e[1])
def docheck_locations
Definition: project.py:2265
def python.projectapp.ProjectApp.close (   self)

Definition at line 1225 of file projectapp.py.

1226  def close(self):
1227  self.root.destroy()
def python.projectapp.ProjectApp.declare (   self,
  ana = False 
)

Definition at line 780 of file projectapp.py.

781  def declare(self, ana=False):
782  if self.current_project_def == None:
783  tkinter_messagebox.showwarning('', 'No project selected.')
784  return
785  if self.current_stage_def == None:
786  tkinter_messagebox.showwarning('', 'No stage selected.')
787  return
788  top=self.winfo_toplevel()
789  old_cursor = top['cursor']
790  try:
791  top['cursor'] = 'watch'
792  top.update_idletasks()
793  project.docheck_declarations(self.current_stage_def.logdir,
794  self.current_stage_def.outdir, declare=True, ana=ana)
795  top['cursor'] = old_cursor
796  except:
797  top['cursor'] = old_cursor
798  e = sys.exc_info()
799  traceback.print_tb(e[2])
800  tkinter_messagebox.showerror('', e[1])
def docheck_declarations
Definition: project.py:2071
def python.projectapp.ProjectApp.declare_ana (   self)

Definition at line 803 of file projectapp.py.

804  def declare_ana(self):
805  self.declare(ana=True)
def python.projectapp.ProjectApp.define (   self,
  ana = False 
)

Definition at line 866 of file projectapp.py.

867  def define(self, ana=False):
868  if self.current_project_def == None:
869  tkinter_messagebox.showwarning('', 'No project selected.')
870  return
871  if self.current_stage_def == None:
872  tkinter_messagebox.showwarning('', 'No stage selected.')
873  return
874  top=self.winfo_toplevel()
875  old_cursor = top['cursor']
876 
877  defname = ''
878  if ana:
879  defname = self.current_stage_def.ana_defname
880  else:
881  defname = self.current_stage_def.defname
882 
883  try:
884  top['cursor'] = 'watch'
885  top.update_idletasks()
886  dim = project_utilities.dimensions_datastream(self.current_project_def,
887  self.current_stage_def,
888  ana=ana)
889  project.docheck_definition(defname, dim, define=True)
890  top['cursor'] = old_cursor
891  except:
892  top['cursor'] = old_cursor
893  e = sys.exc_info()
894  traceback.print_tb(e[2])
895  tkinter_messagebox.showerror('', e[1])
def docheck_definition
Definition: project.py:2176
def python.projectapp.ProjectApp.define_ana (   self)

Definition at line 898 of file projectapp.py.

899  def define_ana(self):
900  self.define(ana=True)
def python.projectapp.ProjectApp.fetchlog (   self)

Definition at line 520 of file projectapp.py.

521  def fetchlog(self):
522  if self.current_project_def == None:
523  tkinter_messagebox.showwarning('', 'No project selected.')
524  return
525  if self.current_stage_def == None:
526  tkinter_messagebox.showwarning('', 'No stage selected.')
527  return
528  top=self.winfo_toplevel()
529  old_cursor = top['cursor']
530  try:
531  top['cursor'] = 'watch'
532  top.update_idletasks()
534  top['cursor'] = old_cursor
535  except:
536  top['cursor'] = old_cursor
537  e = sys.exc_info()
538  traceback.print_tb(e[2])
539  tkinter_messagebox.showerror('', e[1])
def dofetchlog
Definition: project.py:1946
def python.projectapp.ProjectApp.help (   self)

Definition at line 1199 of file projectapp.py.

1200  def help(self):
1201 
1202  # Capture output from project.py --help.
1203  # Because of the way this command is implemented in project.py, we have
1204  # to run in a separate process, not just call method help of project module.
1205 
1206  command = ['project.py', '--help']
1207  helptext = convert_str(subprocess.check_output(command))
1208  w = TextWindow()
1209  w.append(helptext)
def python.projectapp.ProjectApp.kill_jobs (   self)

Definition at line 646 of file projectapp.py.

647  def kill_jobs(self):
648  if self.current_project_def == None:
649  tkinter_messagebox.showwarning('', 'No project selected.')
650  return
651  if self.current_stage_def == None:
652  tkinter_messagebox.showwarning('', 'No stage selected.')
653  return
654 
655  top=self.winfo_toplevel()
656  old_cursor = top['cursor']
657  try:
658  top['cursor'] = 'watch'
659  top.update_idletasks()
660  BatchStatus.update_jobs()
661  jobs = BatchStatus.get_jobs()
662  top['cursor'] = old_cursor
663  except:
664  top['cursor'] = old_cursor
665  e = sys.exc_info()
666  traceback.print_tb(e[2])
667  tkinter_messagebox.showerror('', e[1])
668 
669  # Figure out which clusters to kill.
670 
671  cluster_ids = set()
672  for job in jobs:
673  words = job.split()
674  if len(words) >= 2:
675  jobid = words[0]
676  script = words[-1]
677  workscript = '%s-%s-%s.sh' % (self.current_stage_def.name,
678  self.current_project_def.name,
679  self.current_project_def.release_tag)
680  if script.find(workscript) == 0:
681  cp_server = jobid.split('@')
682  if len(cp_server) == 2:
683  clusproc = cp_server[0]
684  server = cp_server[1]
685  cp = clusproc.split('.')
686  if len(cp) == 2:
687  cluster = cp[0]
688  process = cp[1]
689  cluster_id = '%s@%s' % (cluster, server)
690  if not cluster_id in cluster_ids:
691  cluster_ids.add(cluster_id)
692 
693  # Actually issue kill commands.
694 
695  for cluster_id in cluster_ids:
696  print('Kill cluster id %s' % cluster_id)
697  command = ['jobsub_rm']
698  if self.current_project_def.server != '-' and self.current_project_def.server != '':
699  command.append('--jobsub-server=%s' % self.current_project_def.server)
700  command.append('--jobid=%s' % cluster_id)
701  command.append('--role=%s' % project_utilities.get_role())
702  jobinfo = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
703  jobout, joberr = jobinfo.communicate()
704  jobout = convert_str(jobout)
705  joberr = convert_str(joberr)
706  rc = jobinfo.poll()
707  if rc != 0:
708  raise JobsubError(command, rc, jobout, joberr)
709 
710  self.update_jobs()
711 
do one_file $F done echo for F in find $TOP name CMakeLists txt print
def python.projectapp.ProjectApp.make_menubar (   self)

Definition at line 129 of file projectapp.py.

130  def make_menubar(self):
131 
132  # Put menu in its own frame.
134  self.menubar = tk.Frame(self)
135  self.menubar.grid(row=0, column=0, sticky=tk.E+tk.W)
136 
137  # File menu.
138 
139  mbutton = tk.Menubutton(self.menubar, text='File', font=tkinter_font.Font(size=12))
140  mbutton.pack(side=tk.LEFT)
141  file_menu = tk.Menu(mbutton)
142  file_menu.add_command(label='Open Project', command=self.open)
143  file_menu.add_command(label='Quit', command=self.close)
144  mbutton['menu'] = file_menu
145 
146  # View menu.
147 
148  mbutton = tk.Menubutton(self.menubar, text='View', font=tkinter_font.Font(size=12))
149  mbutton.pack(side=tk.LEFT)
150  view_menu = tk.Menu(mbutton)
151  view_menu.add_command(label='XML', command=self.xml_display)
152  mbutton['menu'] = view_menu
153 
154  # Project menu.
155 
156  mbutton = tk.Menubutton(self.menubar, text='Project', font=tkinter_font.Font(size=12))
157  mbutton.pack(side=tk.LEFT)
158  self.project_menu = tk.Menu(mbutton)
159  self.project_menu.add_command(label='Next Project', command=self.next_project,
160  accelerator='PgUp')
161  self.project_menu.add_command(label='Previous Project', command=self.previous_project,
162  accelerator='PgDn')
163  self.project_menu.add_separator()
164  mbutton['menu'] = self.project_menu
165 
166  # Add project menu key bindings.
167 
168  self.project_menu.bind_all('<KeyPress-KP_Next>', self.next_project_handler)
169  self.project_menu.bind_all('<KeyPress-Next>', self.next_project_handler)
170  self.project_menu.bind_all('<KeyPress-KP_Prior>', self.previous_project_handler)
171  self.project_menu.bind_all('<KeyPress-Prior>', self.previous_project_handler)
172 
173  # Stage menu.
174 
175  mbutton = tk.Menubutton(self.menubar, text='Stage', font=tkinter_font.Font(size=12))
176  mbutton.pack(side=tk.LEFT)
177  self.stage_menu = tk.Menu(mbutton)
178  self.stage_menu.add_command(label='Next Stage', command=self.next_stage,
179  accelerator='Up')
180  self.stage_menu.add_command(label='Previous Stage', command=self.previous_stage,
181  accelerator='Down')
182  self.stage_menu.add_separator()
183  mbutton['menu'] = self.stage_menu
184 
185  # Add stage menu key bindings.
186 
187  self.stage_menu.bind_all('<KeyPress-KP_Up>', self.previous_stage_handler)
188  self.stage_menu.bind_all('<KeyPress-Up>', self.previous_stage_handler)
189  self.stage_menu.bind_all('<KeyPress-KP_Down>', self.next_stage_handler)
190  self.stage_menu.bind_all('<KeyPress-Down>', self.next_stage_handler)
191 
192  # Output menu.
193 
194  mbutton = tk.Menubutton(self.menubar, text='Output', font=tkinter_font.Font(size=12))
195  mbutton.pack(side=tk.LEFT)
196  self.output_menu = tk.Menu(mbutton)
197  self.output_menu.add_command(label='Check', command=self.check)
198  self.output_menu.add_command(label='Checkana', command=self.checkana)
199  self.output_menu.add_command(label='Fetchlog', command=self.fetchlog)
200  self.output_menu.add_command(label='Shorten', command=self.shorten)
201  self.output_menu.add_separator()
202  self.output_menu.add_command(label='Histogram merge', command=self.mergehist)
203  self.output_menu.add_command(label='Ntuple merge', command=self.mergentuple)
204  self.output_menu.add_command(label='Custom merge', command=self.merge)
205  self.output_menu.add_separator()
206  self.output_menu.add_command(label='Clean', command=self.clean)
207  mbutton['menu'] = self.output_menu
208 
209  # Batch menu.
210 
211  mbutton = tk.Menubutton(self.menubar, text='Batch', font=tkinter_font.Font(size=12))
212  mbutton.pack(side=tk.LEFT)
213  self.batch_menu = tk.Menu(mbutton)
214  self.batch_menu.add_command(label='Submit', command=self.submit)
215  self.batch_menu.add_command(label='Makeup', command=self.makeup)
216  self.batch_menu.add_command(label='Update', command=self.update_jobs)
217  self.batch_menu.add_command(label='Kill', command=self.kill_jobs)
218  mbutton['menu'] = self.batch_menu
219 
220  # SAM-art menu.
221 
222  mbutton = tk.Menubutton(self.menubar, text='SAM-art', font=tkinter_font.Font(size=12))
223  mbutton.pack(side=tk.LEFT)
224  self.sam_menu = tk.Menu(mbutton)
225  self.sam_menu.add_command(label='Check Declarations', command=self.check_declarations)
226  self.sam_menu.add_command(label='Declare Files', command=self.declare)
227  self.sam_menu.add_command(label='Test Declarations', command=self.test_declarations)
228  self.sam_menu.add_separator()
229  self.sam_menu.add_command(label='Check Dataset Definition', command=self.check_definition)
230  self.sam_menu.add_command(label='Create Dataset Definition', command=self.define)
231  self.sam_menu.add_command(label='Test Dataset Definition', command=self.test_definition)
232  self.sam_menu.add_separator()
233  self.sam_menu.add_command(label='Check Locations', command=self.check_locations)
234  self.sam_menu.add_command(label='Check Tape Locations', command=self.check_tape)
235  self.sam_menu.add_command(label='Add Disk Locations', command=self.add_locations)
236  self.sam_menu.add_command(label='Clean Disk Locations', command=self.clean_locations)
237  self.sam_menu.add_command(label='Remove Disk Locations', command=self.remove_locations)
238  self.sam_menu.add_command(label='Upload to Enstore', command=self.upload)
239  self.sam_menu.add_separator()
240  self.sam_menu.add_command(label='Audit', command=self.audit)
241  mbutton['menu'] = self.sam_menu
242 
243  # SAM-ana menu.
244 
245  mbutton = tk.Menubutton(self.menubar, text='SAM-ana', font=tkinter_font.Font(size=12))
246  mbutton.pack(side=tk.LEFT)
247  self.sam_menu = tk.Menu(mbutton)
248  self.sam_menu.add_command(label='Check Declarations', command=self.check_ana_declarations)
249  self.sam_menu.add_command(label='Declare Files', command=self.declare_ana)
250  self.sam_menu.add_command(label='Test Declarations', command=self.test_ana_declarations)
251  self.sam_menu.add_separator()
252  self.sam_menu.add_command(label='Check Dataset Definition',
253  command=self.check_ana_definition)
254  self.sam_menu.add_command(label='Create Dataset Definition', command=self.define_ana)
255  self.sam_menu.add_command(label='Test Dataset Definition',
256  command=self.test_ana_definition)
257  self.sam_menu.add_separator()
258  self.sam_menu.add_command(label='Check Locations', command=self.check_ana_locations)
259  self.sam_menu.add_command(label='Check Tape Locations', command=self.check_ana_tape)
260  self.sam_menu.add_command(label='Add Disk Locations', command=self.add_ana_locations)
261  self.sam_menu.add_command(label='Clean Disk Locations', command=self.clean_ana_locations)
262  self.sam_menu.add_command(label='Remove Disk Locations', command=self.remove_ana_locations)
263  self.sam_menu.add_command(label='Upload to Enstore', command=self.upload_ana)
264  #self.sam_menu.add_separator()
265  #self.sam_menu.add_command(label='Audit', command=self.audit_ana)
266  mbutton['menu'] = self.sam_menu
267 
268  # Help menu.
269 
270  mbutton = tk.Menubutton(self.menubar, text='Help', font=tkinter_font.Font(size=12))
271  mbutton.pack(side=tk.RIGHT)
272  self.help_menu = tk.Menu(mbutton)
273  self.help_menu.add_command(label='project.py help', command=self.help)
274  self.help_menu.add_command(label='XML help', command=self.xmlhelp)
275  mbutton['menu'] = self.help_menu
276 
277  return
def python.projectapp.ProjectApp.make_widgets (   self)

Definition at line 93 of file projectapp.py.

93 
94  def make_widgets(self):
95 
96  self.rowconfigure(2, weight=1)
97  self.columnconfigure(0, weight=1)
98 
99  # Make menu bar (row 0).
100 
101  self.make_menubar()
102 
103  # Add project view widget (row 1).
105  self.project_view = ProjectView(self)
106  self.project_view.grid(row=1, column=0, sticky=tk.E+tk.W)
107 
108  # Add console window widget (row 2).
110  self.console = TextWindow(self)
111  self.console.grid(row=2, column=0, sticky=tk.N+tk.E+tk.W+tk.S)
112 
113  # From now on, send standard and diagnostic output to console window.
114 
115  sys.stdout = self.console
116  sys.stderr = self.console
117 
118  # Schedule the idle callback.
119 
120  self.after(120000, self.often)
def python.projectapp.ProjectApp.makeup (   self)

Definition at line 615 of file projectapp.py.

616  def makeup(self):
617  if self.current_project_def == None:
618  tkinter_messagebox.showwarning('', 'No project selected.')
619  return
620  if self.current_stage_def == None:
621  tkinter_messagebox.showwarning('', 'No stage selected.')
622  return
623 
624  top=self.winfo_toplevel()
625  old_cursor = top['cursor']
626  try:
627  top['cursor'] = 'watch'
628  top.update_idletasks()
630  recur=self.current_stage_def.recur)
631  top['cursor'] = old_cursor
632  except:
633  top['cursor'] = old_cursor
634  e = sys.exc_info()
635  traceback.print_tb(e[2])
636  tkinter_messagebox.showerror('', e[1])
637  BatchStatus.update_jobs()
638  self.project_view.update_status()
def dosubmit
Definition: project.py:3634
def python.projectapp.ProjectApp.merge (   self)

Definition at line 758 of file projectapp.py.

759  def merge(self):
760  if self.current_project_def == None:
761  tkinter_messagebox.showwarning('', 'No project selected.')
762  return
763  if self.current_stage_def == None:
764  tkinter_messagebox.showwarning('', 'No stage selected.')
765  return
766  top=self.winfo_toplevel()
767  old_cursor = top['cursor']
768  try:
769  top['cursor'] = 'watch'
770  top.update_idletasks()
771  project.domerge(self.current_stage_def, mergehist=False, mergentuple=False)
772  top['cursor'] = old_cursor
773  except:
774  top['cursor'] = old_cursor
775  e = sys.exc_info()
776  traceback.print_tb(e[2])
777  tkinter_messagebox.showerror('', e[1])
def domerge
Definition: project.py:3721
def python.projectapp.ProjectApp.mergehist (   self)

Definition at line 714 of file projectapp.py.

715  def mergehist(self):
716  if self.current_project_def == None:
717  tkinter_messagebox.showwarning('', 'No project selected.')
718  return
719  if self.current_stage_def == None:
720  tkinter_messagebox.showwarning('', 'No stage selected.')
721  return
722  top=self.winfo_toplevel()
723  old_cursor = top['cursor']
724  try:
725  top['cursor'] = 'watch'
726  top.update_idletasks()
727  project.domerge(self.current_stage_def, mergehist=True, mergentuple=False)
728  top['cursor'] = old_cursor
729  except:
730  top['cursor'] = old_cursor
731  e = sys.exc_info()
732  traceback.print_tb(e[2])
733  tkinter_messagebox.showerror('', e[1])
def domerge
Definition: project.py:3721
def python.projectapp.ProjectApp.mergentuple (   self)

Definition at line 736 of file projectapp.py.

737  def mergentuple(self):
738  if self.current_project_def == None:
739  tkinter_messagebox.showwarning('', 'No project selected.')
740  return
741  if self.current_stage_def == None:
742  tkinter_messagebox.showwarning('', 'No stage selected.')
743  return
744  top=self.winfo_toplevel()
745  old_cursor = top['cursor']
746  try:
747  top['cursor'] = 'watch'
748  top.update_idletasks()
749  project.domerge(self.current_stage_def, mergehist=False, mergentuple=True)
750  top['cursor'] = old_cursor
751  except:
752  top['cursor'] = old_cursor
753  e = sys.exc_info()
754  traceback.print_tb(e[2])
755  tkinter_messagebox.showerror('', e[1])
def domerge
Definition: project.py:3721
def python.projectapp.ProjectApp.next_project (   self)

Definition at line 401 of file projectapp.py.

402  def next_project(self):
403 
404  # Don't do anything if the project list is empty.
405 
406  if len(self.projects) == 0:
407  return
408 
409  # Cycle through list of known projects.
410 
411  found = False
412  for project_tuple in self.projects:
413  project_name = project_tuple[0]
414  if found:
415  self.choose_project(project_name)
416  return
417  if project_name == self.current_project_name:
418  found = True
419 
420  # Choose first project if we fell out of the loop.
421 
422  self.choose_project(self.projects[0][0])
def python.projectapp.ProjectApp.next_project_handler (   self,
  event 
)

Definition at line 391 of file projectapp.py.

392  def next_project_handler(self, event):
self.next_project()
def python.projectapp.ProjectApp.next_stage (   self)

Definition at line 453 of file projectapp.py.

454  def next_stage(self):
455 
457  circular=True)
458  self.choose_stage(stage.name)
459  return
460 
def next_stage
Definition: project.py:762
def python.projectapp.ProjectApp.next_stage_handler (   self,
  event 
)

Definition at line 395 of file projectapp.py.

396  def next_stage_handler(self, event):
self.next_stage()
def python.projectapp.ProjectApp.often (   self)

Definition at line 123 of file projectapp.py.

124  def often(self):
125  self.update_jobs()
126  self.after(120000, self.often)
def python.projectapp.ProjectApp.open (   self,
  xml_path = None,
  choose = True 
)

Definition at line 280 of file projectapp.py.

281  def open(self, xml_path=None, choose=True):
282  if xml_path == None:
283  types = (('XML files', '*.xml'),
284  ('All files', '*'))
285  d = tkinter_filedialog.Open(filetypes=types, parent=self.root)
286  xml_path = d.show()
287 
288  # Parse xml into ProjectDef objects.
289  # This step can raise an exception for several reasons. In that case,
290  # display a message and return without opening the file.
291 
292  top=self.winfo_toplevel()
293  old_cursor = top['cursor']
294  project_defs = []
295  try:
296  top['cursor'] = 'watch'
297  top.update_idletasks()
298  new_project_defs = project.get_projects(xml_path)
299  if len(new_project_defs) > 0:
300  project_defs.extend(new_project_defs)
301  top['cursor'] = old_cursor
302  except:
303  top['cursor'] = old_cursor
304  e = sys.exc_info()
305  message = 'Error opening %s\n%s' % (xml_path, e[1])
306  traceback.print_tb(e[2])
307  tkinter_messagebox.showerror('', message)
308  return
309 
310  if len(project_defs) > 0:
311  project_name = project_defs[0].name
312  else:
313  xml_name = os.path.basename(xml_path)
314  n = xml_name.find('.xml')
315  if n > 0:
316  project_name = xml_name[0: n]
317  else:
318  project_name = xml_name
319 
320  # See if this project is already in the list of open projects.
321  # If so, just choose this project, but don't open it again.
322 
323  for project_tuple in self.projects:
324  if project_name == project_tuple[0]:
325  if choose:
326  self.choose_project(project_name)
327  return
328 
329  # Add this project to the list of known projects.
330 
331  self.projects.append((project_name, xml_path, project_defs))
332 
333  # Update project menu.
334 
335  callback = tk._setit(tk.StringVar(), project_name, callback=self.choose_project)
336  self.project_menu.add_command(label=project_name, command=callback)
337 
338  # Choose just-opened project.
339 
340  if choose:
341  self.choose_project(project_name)
def get_projects
Definition: project.py:700
def python.projectapp.ProjectApp.previous_project (   self)

Definition at line 425 of file projectapp.py.

426  def previous_project(self):
427 
428  # Don't do anything if the project list is empty.
429 
430  if len(self.projects) == 0:
431  return
432 
433  # Cycle through list of known projects.
434 
435  previous_project_name = self.projects[-1][0]
436  for project_tuple in self.projects:
437  project_name = project_tuple[0]
438  if project_name == self.current_project_name:
439  self.choose_project(previous_project_name)
440  return
441  previous_project_name = project_name
442 
443  # Choose the last project if we fell out of the loop.
444 
445  self.choose_project(self.projects[-1][0])
def python.projectapp.ProjectApp.previous_project_handler (   self,
  event 
)

Definition at line 393 of file projectapp.py.

394  def previous_project_handler(self, event):
self.previous_project()
def python.projectapp.ProjectApp.previous_stage (   self)

Definition at line 463 of file projectapp.py.

464  def previous_stage(self):
465 
467  circular=True)
468  self.choose_stage(stage.name)
469  return
470 
def previous_stage
Definition: project.py:788
def python.projectapp.ProjectApp.previous_stage_handler (   self,
  event 
)

Definition at line 397 of file projectapp.py.

398  def previous_stage_handler(self, event):
399  self.previous_stage()
def python.projectapp.ProjectApp.remove_ana_locations (   self)

Definition at line 1138 of file projectapp.py.

1139  def remove_ana_locations(self):
1140  self.remove_locations(ana=True)
def python.projectapp.ProjectApp.remove_locations (   self,
  ana = False 
)

Definition at line 1109 of file projectapp.py.

1110  def remove_locations(self, ana=False):
1111  if self.current_project_def == None:
1112  tkinter_messagebox.showwarning('', 'No project selected.')
1113  return
1114  if self.current_stage_def == None:
1115  tkinter_messagebox.showwarning('', 'No stage selected.')
1116  return
1117  top=self.winfo_toplevel()
1118  old_cursor = top['cursor']
1119  try:
1120  top['cursor'] = 'watch'
1121  top.update_idletasks()
1122  dim = project_utilities.dimensions_datastream(self.current_project_def,
1123  self.current_stage_def,
1124  ana=ana)
1125  project.docheck_locations(dim, self.current_stage_def.outdir,
1126  add=False,
1127  clean=False,
1128  remove=True,
1129  upload=False)
1130  top['cursor'] = old_cursor
1131  except:
1132  top['cursor'] = old_cursor
1133  e = sys.exc_info()
1134  traceback.print_tb(e[2])
1135  tkinter_messagebox.showerror('', e[1])
def docheck_locations
Definition: project.py:2265
def python.projectapp.ProjectApp.shorten (   self)

Definition at line 542 of file projectapp.py.

543  def shorten(self):
544  if self.current_project_def == None:
545  tkinter_messagebox.showwarning('', 'No project selected.')
546  return
547  if self.current_stage_def == None:
548  tkinter_messagebox.showwarning('', 'No stage selected.')
549  return
550  top=self.winfo_toplevel()
551  old_cursor = top['cursor']
552  try:
553  top['cursor'] = 'watch'
554  top.update_idletasks()
556  top['cursor'] = old_cursor
557  except:
558  top['cursor'] = old_cursor
559  e = sys.exc_info()
560  traceback.print_tb(e[2])
561  tkinter_messagebox.showerror('', e[1])
562  self.project_view.update_status()
def doshorten
Definition: project.py:970
def python.projectapp.ProjectApp.submit (   self)

Definition at line 589 of file projectapp.py.

590  def submit(self):
591  if self.current_project_def == None:
592  tkinter_messagebox.showwarning('', 'No project selected.')
593  return
594  if self.current_stage_def == None:
595  tkinter_messagebox.showwarning('', 'No stage selected.')
596  return
597 
598  top=self.winfo_toplevel()
599  old_cursor = top['cursor']
600  try:
601  top['cursor'] = 'watch'
602  top.update_idletasks()
603  project.dosubmit(self.current_project_def, self.current_stage_def, makeup=False,
604  recur=self.current_stage_def.recur)
605  top['cursor'] = old_cursor
606  except:
607  top['cursor'] = old_cursor
608  e = sys.exc_info()
609  traceback.print_tb(e[2])
610  tkinter_messagebox.showerror('', e[1])
611  BatchStatus.update_jobs()
612  self.project_view.update_status()
def dosubmit
Definition: project.py:3634
def python.projectapp.ProjectApp.test_ana_declarations (   self)

Definition at line 861 of file projectapp.py.

862  def test_ana_declarations(self):
863  self.test_declarations(ana=True)
def python.projectapp.ProjectApp.test_ana_definition (   self)

Definition at line 972 of file projectapp.py.

973  def test_ana_definition(self):
974  self.test_definition(ana=True)
def python.projectapp.ProjectApp.test_declarations (   self,
  ana = False 
)

Definition at line 836 of file projectapp.py.

837  def test_declarations(self, ana=False):
838  if self.current_project_def == None:
839  tkinter_messagebox.showwarning('', 'No project selected.')
840  return
841  if self.current_stage_def == None:
842  tkinter_messagebox.showwarning('', 'No stage selected.')
843  return
844  top=self.winfo_toplevel()
845  old_cursor = top['cursor']
846  try:
847  top['cursor'] = 'watch'
848  top.update_idletasks()
849  dim = project_utilities.dimensions_datastream(self.current_project_def,
850  self.current_stage_def,
851  ana=ana)
853  top['cursor'] = old_cursor
854  except:
855  top['cursor'] = old_cursor
856  e = sys.exc_info()
857  traceback.print_tb(e[2])
858  tkinter_messagebox.showerror('', e[1])
def dotest_declarations
Definition: project.py:2158
def python.projectapp.ProjectApp.test_definition (   self,
  ana = False 
)

Definition at line 940 of file projectapp.py.

941  def test_definition(self, ana=False):
942  if self.current_project_def == None:
943  tkinter_messagebox.showwarning('', 'No project selected.')
944  return
945  if self.current_stage_def == None:
946  tkinter_messagebox.showwarning('', 'No stage selected.')
947  return
948 
949  defname = ''
950  if ana:
951  defname = self.current_stage_def.ana_defname
952  else:
953  defname = self.current_stage_def.defname
954  if defname == '':
955  tkinter_messagebox.showwarning('No sam dataset definition specified.')
956  return
957 
958  top=self.winfo_toplevel()
959  old_cursor = top['cursor']
960  try:
961  top['cursor'] = 'watch'
962  top.update_idletasks()
964  top['cursor'] = old_cursor
965  except:
966  top['cursor'] = old_cursor
967  e = sys.exc_info()
968  traceback.print_tb(e[2])
969  tkinter_messagebox.showerror('', e[1])
def dotest_definition
Definition: project.py:2217
def python.projectapp.ProjectApp.update_jobs (   self)

Definition at line 641 of file projectapp.py.

642  def update_jobs(self):
643  self.project_view.update_jobs()
def python.projectapp.ProjectApp.upload (   self,
  ana = False 
)

Definition at line 1143 of file projectapp.py.

1144  def upload(self, ana=False):
1145  if self.current_project_def == None:
1146  tkinter_messagebox.showwarning('', 'No project selected.')
1147  return
1148  if self.current_stage_def == None:
1149  tkinter_messagebox.showwarning('', 'No stage selected.')
1150  return
1151  top=self.winfo_toplevel()
1152  old_cursor = top['cursor']
1153  try:
1154  top['cursor'] = 'watch'
1155  top.update_idletasks()
1156  dim = project_utilities.dimensions_datastream(self.current_project_def,
1157  self.current_stage_def,
1158  ana=ana)
1159  project.docheck_locations(dim, self.current_stage_def.outdir,
1160  add=False,
1161  clean=False,
1162  remove=False,
1163  upload=True)
1164  top['cursor'] = old_cursor
1165  except:
1166  top['cursor'] = old_cursor
1167  e = sys.exc_info()
1168  traceback.print_tb(e[2])
1169  tkinter_messagebox.showerror('', e[1])
def docheck_locations
Definition: project.py:2265
def python.projectapp.ProjectApp.upload_ana (   self)

Definition at line 1172 of file projectapp.py.

1173  def upload_ana(self):
1174  self.upload(ana=True)
def python.projectapp.ProjectApp.xml_display (   self)

Definition at line 448 of file projectapp.py.

449  def xml_display(self):
450  self.project_view.make_xml_window()
def python.projectapp.ProjectApp.xmlhelp (   self)

Definition at line 1212 of file projectapp.py.

1213  def xmlhelp(self):
1214 
1215  # Capture output from project.py --xmlhelp.
1216  # Because of the way this command is implemented in project.py, we have
1217  # to run in a separate process, not just call method xmlhelp of project module.
1218 
1219  command = ['project.py', '--xmlhelp']
1220  helptext = convert_str(subprocess.check_output(command))
1221  w = TextWindow()
1222  w.append(helptext)

Member Data Documentation

python.projectapp.ProjectApp.batch_menu

Definition at line 212 of file projectapp.py.

python.projectapp.ProjectApp.console

Definition at line 109 of file projectapp.py.

python.projectapp.ProjectApp.current_project_def

Definition at line 75 of file projectapp.py.

python.projectapp.ProjectApp.current_project_defs

Definition at line 74 of file projectapp.py.

python.projectapp.ProjectApp.current_project_name

Definition at line 73 of file projectapp.py.

python.projectapp.ProjectApp.current_stage_def

Definition at line 77 of file projectapp.py.

python.projectapp.ProjectApp.current_stage_name

Definition at line 76 of file projectapp.py.

python.projectapp.ProjectApp.help_menu

Definition at line 271 of file projectapp.py.

python.projectapp.ProjectApp.menubar

Definition at line 133 of file projectapp.py.

python.projectapp.ProjectApp.output_menu

Definition at line 195 of file projectapp.py.

python.projectapp.ProjectApp.project_menu

Definition at line 157 of file projectapp.py.

python.projectapp.ProjectApp.project_view

Definition at line 104 of file projectapp.py.

python.projectapp.ProjectApp.projects

Definition at line 81 of file projectapp.py.

python.projectapp.ProjectApp.root

Definition at line 56 of file projectapp.py.

python.projectapp.ProjectApp.sam_menu

Definition at line 223 of file projectapp.py.

python.projectapp.ProjectApp.stage_menu

Definition at line 176 of file projectapp.py.


The documentation for this class was generated from the following file: