def __init__(self, subsystems, logger=None, version_file='ccs_versions.txt'): """ Constructor. Parameters ---------- subsystems : dict A dictionary of subsystem names keyed by desired attribute name, e.g., dict(ts8='ts8', pd='ts/PhotoDiode', mono='ts/Monochromator') logger : logging.Logger, optional Logger to be used by the SubsystemDecorator class. Default: None. version_file : str, optional Text file to contain the CCS subsystem version information. This can be set to None to suppress writing the file. Default: 'ccs_versions.txt'. """ self._proxy_subsystems = ccs_python_proxies.CCS.subsystem_names for key, value in subsystems.items(): if value in self._proxy_subsystems: proxy_subsystem = ccs_python_proxies.CCS.attachSubsystem(value) self.__dict__[key] = SubsystemDecorator(proxy_subsystem, logger=logger, name=value) continue self.__dict__[key] = SubsystemDecorator(CCS.attachSubsystem(value), logger=logger, name=value) self.version_file = version_file self._get_version_info(subsystems)
def CCSattachProxy(target): """ Improve reliability """ for i in range(3): logging.info("{}: {}".format(target, i)) try: return CCS.attachProxy(target) except RuntimeException as ex: logging.error(ex) time.sleep(1) pass raise
def _get_version_info(self, subsystems): # Version info is only available for "real" subsystems like # 'ts' or 'ts8-bench', not whatever things like # 'ts/Monochromator' are called in CCS parlance. So extract # the parts before the '/' as the "real" subsystem names of # interest real_subsystems = set([ x.split('/')[0] for x in subsystems.values() if x not in self._proxy_subsystems ]) self.subsystems = OrderedDict() for subsystem in real_subsystems: my_subsystem = CCS.attachSubsystem(subsystem) reply = my_subsystem.synchCommand(10, 'getDistributionInfo') try: result = reply.getResult().toString() self.subsystems[subsystem] = self._parse_version_info(result) except AttributeError: # Running in python for unit tests. pass
############################################################################### # REB-PS safe power off # # # author: homer 10/2016 # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception from java.lang import RuntimeException import sys import time import subprocess CCS.setThrowExceptions(True); def check_currents(rebid,pwr_chan,reb_chan,low_lim,high_lim,chkreb): # print "Retrieving REB PS current %s " % pwr_chan cur_ps = pwrsub.synchCommand(10,"getChannelValue REB%d.%s.IaftLDO" % (rebid,pwr_chan)).getResult() # print "Retrieving REB current %s " % reb_chan cur_reb = ts8sub.synchCommand(10,"getChannelValue R00.Reb%d.%s" % (rebid,reb_chan)).getResult() # print "verifying that the current is with limits" if (chkreb) : stat = "%s: - checking %10.10s : OK - PS value is %8.3f mAmps, REB value is %8.3f mAmps" % (rebname,pwr_chan,cur_ps,cur_reb) else : stat = "%s: - checking %10.10s : OK - PS value is %8.3f mAmps, REB not yet ON" % (rebname,pwr_chan,cur_ps) # if (cur_ps < low_lim or
#!/usr/bin/env ccs-script from optparse import OptionParser from org.lsst.ccs.scripting import CCS import os #from ccs import aliases import time #from ccs import proxies ts8 = os.getenv("CCS_TS8") raftid = "R00" #fp = CCS.attachProxy(ts8) #fpr22 = CCS.attachSubsystem("%s/%s" % (ts8,raftid)) fp = CCS.attachSubsystem("%s" % (ts8)) #CCS.setDefaultTimeout(30) for rebname in fp.sendSynchCommand("getREBDeviceNames") : print "========================================================" print "Checking %s at %s" % (rebname,time.strftime('%Y-%m-%dT%H:%M:%S',time.localtime())) fpreb = CCS.attachSubsystem("%s/%s" % (ts8,rebname)) print "%s firmware version = " % rebname , fpreb.sendSynchCommand("getHwVersion") print "%s serial number = " % rebname , fpreb.sendSynchCommand("getSerialNumber") for ch in fp.sendSynchCommand("getChannelNames"): if rebname in ch : print ch, fp.sendSynchCommand("getChannelValue %s" % ch) print "========================================================\n\n" #print fpr22.sendSynchCommand("getREBHwVersions")
############################################################################### # flat # Acquire flat images for RAFT EO testing at TS8 # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib import glob CCS.setThrowExceptions(True) doPD = False runnum = "no-eTrav" try: runnum = RUNNUM #tsCWD.split('/')[len(tsCWD.split('/'))-4] except: pass print "Run number = %s" % runnum if (True): #attach CCS subsystem Devices for scripting print "Attaching teststand subsystems" tssub = CCS.attachSubsystem("%s" % ts) print "attaching Bias subsystem" biassub = CCS.attachSubsystem("%s/Bias" % ts)
############################################################################### # dark # Acquire dark images for RAFT EO testing at TS8 # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib CCS.setThrowExceptions(True); doPD = False runnum = "no-eTrav" try: runnum = RUNNUM # runnum = tsCWD.split('/')[len(tsCWD.split('/'))-4] except: pass print "Run number = %s" % runnum if (True): #attach CCS subsystem Devices for scripting print "Attaching teststand subsystems" tssub = CCS.attachSubsystem("%s" % ts); print "attaching Bias subsystem" biassub = CCS.attachSubsystem("%s/Bias" % ts); print "attaching PD subsystem"
############################################################################### # ready_acq # test the test stand for readiness # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib CCS.setThrowExceptions(True) #try: if True: #attach CCS subsystem Devices for scripting print "Attaching teststand subsystems" tssub = CCS.attachSubsystem("%s" % ts) arcsub = CCS.attachSubsystem("archon") print "attaching Bias subsystem" biassub = CCS.attachSubsystem("%s/Bias" % ts) print "attaching PD subsystem" pdsub = CCS.attachSubsystem("%s/PhotoDiode" % ts) print "attaching Mono subsystem" monosub = CCS.attachSubsystem("%s/Monochromator" % ts) print "attaching PDU subsystem" pdusub = CCS.attachSubsystem("%s/PDU" % ts) print "Attaching archon subsystem" # arcsub = CCS.attachSubsystem("%s" % archon); # print "attaching XED subsystem"
""" Power-on aliveness tests script. See LCA-10064 section 10.4.2.2. """ import os import sys import time from collections import namedtuple import logging import java.lang from org.lsst.ccs.scripting import CCS from ccs_scripting_tools import CcsSubsystems from rebCurrentLimits import RebCurrentLimits from ts8_utils import get_REB_info CCS.setThrowExceptions(True) logging.basicConfig(format="%(message)s", level=logging.INFO, stream=sys.stdout) logger = logging.getLogger() def reb_power_on(ccs_sub, rebid, power_line, ccd_type, raise_exception=True): """ REB power-on script. This implements steps in LCA-10064 section 10.4.2.2. Parameters ---------- ccs_sub : CcsSubsystems object Container for ts8 and rebps subsystems.
############################################################################### # # - Homer ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib CCS.setThrowExceptions(True); cdir = tsCWD rebsub = {} serial_number = {} tssub = CCS.attachSubsystem("ts"); monosub = CCS.attachSubsystem("%s/Monochromator" % ts ); ts8sub = CCS.attachSubsystem("%s" % ts8); cryosub = CCS.attachSubsystem("ts/Cryo"); pwrsub = CCS.attachSubsystem("rebps"); pwrmainsub = CCS.attachSubsystem("rebps/MainCtrl"); rebdevs = ts8sub.synchCommand(10,"getREBDevices").getResult() # set new state istate = tssub.synchCommand(10,"getstate").getResult() print "istate before = ",istate," : " ext = int(jobname.split("__")[1]) if ext>400 :
############################################################################### # # - Homer ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib CCS.setThrowExceptions(True); cdir = tsCWD rebsub = {} serial_number = {} tssub = CCS.attachSubsystem("ts"); monosub = CCS.attachSubsystem("%s/Monochromator" % ts ); ts8sub = CCS.attachSubsystem("%s" % ts8); cryosub = CCS.attachSubsystem("ts/Cryo"); pwrsub = CCS.attachSubsystem("ccs-rebps"); pwrmainsub = CCS.attachSubsystem("ccs-rebps/MainCtrl"); rebdevs = ts8sub.synchCommand(10,"getREBDevices").getResult() # set new state istate = tssub.synchCommand(10,"getstate").getResult() print "istate before = ",istate," : " ext = int(jobname.split("__")[1]) if ext>400 :
#!/usr/bin/env ccs-script import os import time #import config import sys #sys.path.insert(0,"/home/homer/scripts/") from pd import PhotodiodeReadout #from org.lsst.ccs.utilities.location import LocationSet #import jarray from java.lang import String from org.lsst.ccs.scripting import CCS #from ccs import aliases #from ccs import proxies from java.time import Duration #bb = CCS.attachProxy("ts8-bench") bb = CCS.attachSubsystem("ts8-bench") reb0 = CCS.attachSubsystem("ts8-fp/R22/Reb0") def test_pd(exposure): pd_readout = PhotodiodeReadout(exposure) pd_readout.start_accumulation() time.sleep(2.5) print("starting exposure") reb0.sendSynchCommand("setRegister 0x100000 [0x103bc]") # light time.sleep(exposure) reb0.sendSynchCommand("setRegister 0x100000 [0x3bc]") # light print("exposure complete")
############################################################################### # # - Homer ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time CCS.setThrowExceptions(True); cdir = tsCWD rebsub = {} serial_number = {} ts8sub = CCS.attachSubsystem("%s" % ts8); tssub = CCS.attachSubsystem("ts"); cryosub = CCS.attachSubsystem("ts/Cryo"); pwrsub = CCS.attachSubsystem("rebps"); pwrmainsub = CCS.attachSubsystem("rebps/MainCtrl"); rebdevs = ts8sub.synchCommand(10,"getREBDevices").getResult() idx = 0 for id in rebdevs: rebsub[id] = CCS.attachSubsystem("%s/%s" % (ts8,id)); result = pwrsub.synchCommand(20,"setNamedPowerOn %d heater True" % idx).getResult(); result = rebsub[id].synchCommand(10,"setHeaterPower 0 0.0").getResult();
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time import re bb = CCS.attachProxy("ts8-bench") def sanityCheck(): state = bb.getState() alert = state.getState(AlertState) if alert!=AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert def setNDFilter(filter): sanityCheck() print "Setting 1 and 2 SlitWidth",filter bb.Monochromator().setSlitSize(1,int(re.match(r"slit(\d+)",filter).group(1))) bb.Monochromator().setSlitSize(2,int(re.match(r"slit(\d+)",filter).group(1))) def setColorFilter(filter): sanityCheck() print "Setting color filter ",filter bb.Monochromator().setWaveAndFilter(int(filter)) def setSpotFilter(filter): sanityCheck() print "Setting Spot filter "+filter bb.SpotProjFWheel().setNamedPosition(filter)
#!/usr/bin/env ccs-script from optparse import OptionParser from org.lsst.ccs.scripting import CCS #from ccs import aliases import time #from ccs import proxies #fp = CCS.attachProxy("ts7-2/Cryo") ts = CCS.attachSubsystem("ts7-2/Cryo") start = time.time() while (True): print "%f %11.3f %11.3f %11.3f %11.3f %11.3f" % ( time.time(), (time.time() - start), ts.sendSynchCommand("getTemp A"), ts.sendSynchCommand("getTemp B"), ts.sendSynchCommand("getTemp C"), ts.sendSynchCommand("getTemp D")) time.sleep(5.0)
def attachProxy(key): return ccsProxy(CCS.attachSubsystem(key), key)
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import bot_bench fp = CCS.attachProxy("comcam-fp") autoSave = True imageTimeout = Duration.ofSeconds(60) def sanityCheck(): #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on" state = fp.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: focal-plane subsystem is in alert state %s" % alert def clear(n=1): print "Clearing CCDs (%d)" % n fp.clear(n) fp.waitForSequencer(Duration.ofSeconds(10)) def takeBias(fitsHeaderData): # TODO: This may not be the best way to take bias images
from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time ndFilter = False colorFilter = True spot = False shutter = True fe55Shutter = False cb = None ts8mono = None try: cb = CCS.attachProxy("comcam-bench") except: print("No comcam-bench yet!") pass try: ts8mono = CCS.attachSubsystem("ts8-bench/Monochromator") except: print("No comcam-bench yet!") pass def sanityCheck(): state = cb.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from org.lsst.ccs.subsystem.focalplane.states import FocalPlaneState from java.time import Duration from ccs import proxies #import bot_bench import time import array import os CLEARDELAY=0.07 #CLEARDELAY=2.35 fp = CCS.attachProxy("focal-plane") # this will be override by CCS.aliases agentName = fp.getAgentProperty("agentName") if agentName != "focal-plane": fp = CCS.attachProxy(agentName) # re-attach to ccs subsystem autoSave = True imageTimeout = Duration.ofSeconds(60) symlinkToFast = True # These need to be changed when we switch R_and_D -> rawData symLinkFromLocation = "/gpfs/slac/lsst/fs3/g/data/rawData/focal-plane/" symLinkToLocation = "/gpfs/slac/lsst/fs3/g/fast/rawData/focal-plane/" def sanityCheck(): # Was this ever implemented on focal-plane? #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on"
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import bot_bench import array fp = CCS.attachProxy("focal-plane") autoSave = True imageTimeout = Duration.ofSeconds(60) def sanityCheck(): # Was this ever implemented on focal-plane? #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on" state = fp.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: focal-plane subsystem is in alert state %s" % alert def clear(n=1): print "Clearing CCDs (%d)" % n fp.clear(n) fp.waitForSequencer(Duration.ofSeconds(10))
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.scripting import ScriptingStatusBusListener from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time try: bot = CCS.attachProxy("bot-motorplatform") except: print "BOT subsystem not available, attempting to continue" # raise def sanityCheck(): state = bot.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: bot-motorplatform subsystem is in alert state %s" % alert def setLampOffset(x=0, y=0): sanityCheck() print "Setting BOT lamp offset (%g,%g)" % (x, y) bot.enable("X") bot.enable("Y") bot.setLampOffset(x, y) bot.disable("X") bot.disable("Y")
def startListener(ll): CCS.addStatusBusListener( ll, lambda msg: msg.getOrigin() == "bot-motorplatform" and msg. getClassName() == "org.lsst.ccs.bus.messages.StatusSubsystemData" and msg.getBusMessage().getDataKey() == "LampStatus")
# REB-PS safe power on # # # author: homer 10/2016 # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception from java.lang import RuntimeException import sys import time import subprocess #import siteUtils CCS.setThrowExceptions(True) ################################################################# # Check that PS current levels are within acceptable range ################################################################# def check_currents(rebid, pwr_chan, reb_chan, low_lim, high_lim, chkreb): print "Retrieving REB PS current %s " % pwr_chan cur_ps = pwrsub.synchCommand( 10, "getChannelValue REB%d.%s.IaftLDO" % (rebid, pwr_chan)).getResult() print "Retrieving REB current %s " % reb_chan cur_reb = ts8sub.synchCommand( 10, "getChannelValue R00.Reb%d.%s" % (rebid, reb_chan)).getResult()
def stopListener(ll): CCS.removeStatusBusListener(ll)
############################################################################### # REB-PS safe power on # # # author: homer 10/2016 # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time CCS.setThrowExceptions(True); def check_currents(rebid,pwr_chan,reb_chan,low_lim,high_lim,chkreb): # print "Retrieving REB PS current %s " % pwr_chan cur_ps = pwrsub.synchCommand(10,"getChannelValue REB%d.%s.IaftLDO" % (rebid,pwr_chan)).getResult() # print "Retrieving REB current %s " % reb_chan cur_reb = ts8sub.synchCommand(10,"getChannelValue R00.Reb%d.%s" % (rebid,reb_chan)).getResult() # print "verifying that the current is with limits" stat = "%10.10s : OK - PS value is %8.3f , REB value is %8.3f" % (pwr_chan,cur_ps,cur_reb) # if (cur_ps < low_lim or if (cur_ps> high_lim) : pwrsub.synchCommand(10,"setNamedPowerOn %d %s False" % (rebid,pwr)) stat = "Current %s with value %f mA NOT in range %f mA to %f mA. POWER TO THIS CHANNEL HAS BEEN SHUT OFF!" % (pwr_chan,cur_ps,low_lim,high_lim) raise Exception if (abs(cur_ps)>0.0 and chkreb) : if (abs(cur_reb-cur_ps)/cur_ps > 0.20) :
def attachProxy(key, level=0): return ccsProxy(CCS.attachSubsystem(key, level), key)
############################################################################### # # - Homer ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time CCS.setThrowExceptions(True) cdir = tsCWD rebsub = {} serial_number = {} ts8sub = CCS.attachSubsystem("%s" % ts8) tssub = CCS.attachSubsystem("ts") cryosub = CCS.attachSubsystem("ts/Cryo") pwrsub = CCS.attachSubsystem("ccs-rebps") pwrmainsub = CCS.attachSubsystem("ccs-rebps/MainCtrl") rebdevs = ts8sub.synchCommand(10, "getREBDevices").getResult() idx = 0 for id in rebdevs: rebsub[id] = CCS.attachSubsystem("%s/%s" % (ts8, id)) result = pwrsub.synchCommand(20, "setNamedPowerOn %d heater True" % idx).getResult() result = rebsub[id].synchCommand(10, "setHeaterPower 0 0.0").getResult()
def __init__(self, subsystemName, replyHandler): self._subsysName = subsystemName self._subsysHandle = CCS.attachSubsystem(subsystemName) CCS.addStatusBusListener(replyHandler, replyHandler.getMessageFilter())
#!/usr/bin/env ccs-script from optparse import OptionParser from org.lsst.ccs.scripting import CCS from java.time import Duration import time # setup controls ts = CCS.attachSubsystem("ts8-motorplatform") bb = CCS.attachSubsystem("ts8-raft") reb0 = CCS.attachSubsystem("ts8-raft/R00.Reb0") tm = int(time.time()) # set output directory output_dir = "/gpfs/slac/lsst/fs3/g/data/jobHarness/jh_stage/LCA-11021_RTM/LCA-11021_RTM-004/mp_slit_intensitytester/%d/S${sensorLoc}/" % tm bb.sendSynchCommand("setDefaultImageDirectory", output_dir) print("The output directory has been set to - \n" + output_dir) Timeout = Duration.ofSeconds(300) CCS.setDefaultTimeout(Timeout) start = time.time() # reference values #xstart = 310.0 #ystart = 210.0 #xend = 440.0 #yend = 300.0
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time bb = CCS.attachProxy("bot-bench") def sanityCheck(): state = bb.getState() alert = state.getState(AlertState) if alert!=AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert def setNDFilter(filter): sanityCheck() print "Setting ND filter "+filter bb.NeutralFWheel().setNamedPosition(filter) def setColorFilter(filter): sanityCheck() print "Setting Color filter "+filter bb.ColorFWheel().setNamedPosition(filter) def setSpotFilter(filter): sanityCheck() print "Setting Spot filter "+filter bb.SpotProjFWheel().setNamedPosition(filter) # Open the flat field projector shutter
#!/usr/bin/env ccs-script from optparse import OptionParser from org.lsst.ccs.scripting import CCS from java.time import Duration import time # setup controls ts = CCS.attachSubsystem("metrology/Positioner") bb = CCS.attachSubsystem("ts8-raft") tm = int(time.time()) # set output directory output_dir = "/gpfs/slac/lsst/fs3/g/data/jobHarness/jh_stage/LCA-11021_RTM/LCA-11021_RTM-016/post_streakTest1_chk/%d/S${sensorLoc}/" % tm bb.sendSynchCommand("setDefaultImageDirectory", output_dir) print("The output directory has been set to - \n" + output_dir) Timeout = Duration.ofSeconds(600) CCS.setDefaultTimeout(Timeout) start = time.time() # starting point xstart = 65.0 ystart = -72.6 x = xstart y = ystart # step increments
############################################################################### # preflight_acq # test the test stand for readiness # ############################################################################### from org.lsst.ccs.scripting import CCS from java.lang import Exception import sys import time import eolib CCS.setThrowExceptions(True); #attach CCS subsystem Devices for scripting print "Attaching teststand subsystems" tssub = CCS.attachSubsystem("%s" % ts); print "attaching PD subsystem" pdsub = CCS.attachSubsystem("%s/PhotoDiode" % ts); print "attaching Mono subsystem" monosub = CCS.attachSubsystem("%s/Monochromator" % ts ); print "attaching PDU subsystem" pdusub = CCS.attachSubsystem("%s/PDU" % ts ); print "Attaching teststand 8 subsystem" ts8sub = None rebpssub = None usets8 = True try: ts8sub = CCS.attachSubsystem("%s" % ts8);
#!/usr/bin/env ccs-script from optparse import OptionParser from org.lsst.ccs.scripting import CCS from ccs import aliases from ccs import proxies from java.time import Duration # Temporary work around for problems with CCS responsiveness CCS.setDefaultTimeout(Duration.ofSeconds(30)) # Parse command line options parser = OptionParser() parser.add_option("--dry-run", action="store_true", dest="dry_run", default=False) parser.add_option("-9", "--ds9", action="store_true", dest="ds9") parser.add_option("--run", dest="run") parser.add_option("--symlink", dest="symlink") (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() exit(1) #CCS.aliases = {'focal-plane': 'focal-plane-sim', 'bot-bench': 'bot-bench-sim'} #CCS.aliases = {'focal-plane': 'focal-plane-sim'} #ccs_sub.write_versions() import config
#!/usr/bin/env ccs-script import sys import time from optparse import OptionParser from org.lsst.ccs.scripting import CCS from ccs import aliases from ccs import proxies from ccs import versions from ccs import configs from java.time import Duration # Temporary work around for problems with CCS responsiveness CCS.setDefaultTimeout(Duration.ofSeconds(30)) # Parse command line options parser = OptionParser() parser.add_option("--dry-run", action="store_true", dest="dry_run", default=False) parser.add_option("-9", "--ds9", action="store_true", dest="ds9") parser.add_option("--run", dest="run") parser.add_option("--symlink", dest="symlink") parser.add_option("--skip", dest="skip") parser.add_option("--limit", dest="limit") (options, args) = parser.parse_args() if len(args) != 1: parser.print_help()