Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ganga 3 CLIP Tutorial Jakub T. Moscicki ARDA/LHCb Ganga Tutorial, April 2005.

Similar presentations


Presentation on theme: "Ganga 3 CLIP Tutorial Jakub T. Moscicki ARDA/LHCb Ganga Tutorial, April 2005."— Presentation transcript:

1 Ganga 3 CLIP Tutorial Jakub T. Moscicki ARDA/LHCb Ganga Tutorial, April 2005

2 Ganga Tutorial, April 2005 2 Contents Quick introduction to Python  Statements, variables, functions  Modules, classes, objects Basics of Ganga Scripting Interface  simple executable jobs  Simple DaVinci jobs  Job Registry and looping

3 Ganga Tutorial, April 2005 3 Python Website:  www.python.org www.python.org Excelent Python Tutorial:  http://docs.python.org/tut/tut.html http://docs.python.org/tut/tut.html Documentation:  http://docs.python.org/index.html http://docs.python.org/index.html How to start on lxplus at CERN (python 2.2) % python Python 2.2.2 (#1, Jan 30 2003, 21:26:22) >>> ^D % Python Quickstart

4 Ganga Tutorial, April 2005 4 x = 2 print x*3 if x==2: print "yes, x==2" # NOTE INITIAL SPACES! alist = [1,2,3] for y in alist: print y print len(alist) # built-in function len help(len) Statements, Variables

5 Ganga Tutorial, April 2005 5 print range(10) help(range) def square(v): return v*v print square(x) alist = [1,2,3] for i in range(len(alist)): alist[i] = square(alist[i]) Functions

6 Ganga Tutorial, April 2005 6 import sys print sys.argv sys.exit(-1) import os print os.environ['HOME'] from os import environ from os import * import math, cmath Modules

7 Ganga Tutorial, April 2005 7 # user defined classes a = MyClass(2,3) a.my_method(1) #built-in classes: for example strings s = "hello at the tutorial" s.split() s.count('a') s.upper() dir(s) Classes and Objects

8 Ganga Tutorial, April 2005 8 Start Ganga in text mode: % ganga -t >>> from Ganga.CLIP import * Job Objects and Job Registry j = Job() print j print j.application print j.backend print jobs print jobs[1] Ganga Scripting

9 Ganga Tutorial, April 2005 9 Jobs Job { status = 'new', name = '', stdout = None, stderr = None, directory = '/afs/cern.ch/user/k/kuba/myGangaJobs/Job20054141034261971223340468', exitcode = None, id = 7, application = Executable { outputfiles = [], inputfiles = [], parameters = [], exe = '/afs/cern.ch/user/k/kuba' }, backend = Local { id = None }

10 Ganga Tutorial, April 2005 10 j = Job() j.application.exe = '/bin/hostname' j.name = "MyTest" print j j.submit() print j.status print j.directory+'/output' ### open new terminal and inspect output % cat OUTPUTDIR/std.out Basic Job Submission

11 Ganga Tutorial, April 2005 11 for i in range(5): j = Job(exe="/bin/echo", parameters=["hello ",str(i)]) for j in jobs: print j.id, j.directory print j.submit() Jobs in a loop

12 Ganga Tutorial, April 2005 12 j = Job(application="DaVinci") print j j.submit() Default DaVinci Job Submission

13 Ganga Tutorial, April 2005 13 Questions? Practical exercises Questions?


Download ppt "Ganga 3 CLIP Tutorial Jakub T. Moscicki ARDA/LHCb Ganga Tutorial, April 2005."

Similar presentations


Ads by Google