Work towards disabling command-line parsing outside of use
authorBrandon King <kingb@caltech.edu>
Thu, 3 Jan 2008 23:19:22 +0000 (23:19 +0000)
committerBrandon King <kingb@caltech.edu>
Thu, 3 Jan 2008 23:19:22 +0000 (23:19 +0000)
in scripts.

gaworkflow/pipeline/retrieve_config.py
scripts/configure_pipeline
scripts/retrieve_config

index 232ad2a02e23c499f32259f1b5c7d4f7337d84dc..afe3d2e81ca84e2ce08bb769d3b8614f3b0bceb9 100644 (file)
@@ -10,10 +10,18 @@ import urllib
 CONFIG_SYSTEM = '/etc/ga_frontend/ga_frontend.conf'
 CONFIG_USER = os.path.expanduser('~/.ga_frontend.conf')
 
+#Disable or enable commandline arg parsing; disabled by default.
+DISABLE_CMDLINE = True
 
 class FlowCellNotFound(Exception): pass
 class WebError404(Exception): pass
 
+class DummyOptions:
+  """
+  Used when command line parsing is disabled; default
+  """
+  def __init__(self):
+    self.url = None
 
 class PreformattedDescriptionFormatter(IndentedHelpFormatter):
   
@@ -39,6 +47,11 @@ def constructOptionParser():
   """
   returns a pre-setup optparser
   """
+  global DISABLE_CMDLINE
+  
+  if DISABLE_CMDLINE:
+    return None
+  
   parser = OptionParser(formatter=PreformattedDescriptionFormatter())
 
   parser.set_description('Retrieves eland config file from ga_frontend web frontend.')
@@ -91,7 +104,10 @@ def getCombinedOptions():
   cl_parser = constructOptionParser()
   conf_parser = constructConfigParser()
   
-  options, args = cl_parser.parse_args()
+  if cl_parser is None:
+    options = DummyOptions()
+  else:
+    options, args = cl_parser.parse_args()
   
   if options.url is None:
     if conf_parser.has_option('config_file_server', 'base_host_url'):
index 62ebb9b862192f2c79d0f797c25c3829a123c0f9..b5126047a4e00f56d66f62abedff1097471a88c4 100644 (file)
@@ -3,10 +3,13 @@ import os
 import sys
 import re
 from gaworkflow.pipeline.configure_run import *
+from gaworkflow.pipeline import retrieve_config
 from gaworkflow.pipeline.monitors import startCmdLineStatusMonitor
 
 s_fc = re.compile('FC[0-9]+')
 
+#Turn on built-in command-line parsing.
+retrieve_config.DISABLE_CMDLINE = False
 
 GENOME_DIR = '/data-store01/compbio/genomes/'
 
index 56bd7c590edaedd8ef2834b94946d713eabb51a2..c2c740972c11b784f32cbd1f45d7500dc38b3bb2 100644 (file)
@@ -1,6 +1,10 @@
 #!/usr/bin/env python
 import sys
 from gaworkflow.pipeline.retrieve_config import *
+from gaworkflow.pipeline import retrieve_config
+
+#Turn on built-in command-line parsing.
+retrieve_config.DISABLE_CMDLINE = False
 
 def main(args=None):
   #Display help if no args are presented