~jan.greis/maus/1811

« back to all changes in this revision

Viewing changes to src/common_py/Go.py

  • Committer: Chris Rogers
  • Date: 2011-09-28 06:22:41 UTC
  • mfrom: (340.1.235 devel)
  • mto: (614.1.29 maus)
  • mto: This revision was merged to the branch mainline in revision 635.
  • Revision ID: chris.rogers@stfc.ac.uk-20110928062241-ibx91tvbele6l2u2
Add json browser, beam maker, argparse functionality; plus few bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    """
48
48
 
49
49
    def __init__(self, arg_input, arg_mapper, arg_reducer,  # pylint: disable=R0913,C0301
50
 
                 arg_output, arg_config_file = None):
 
50
                 arg_output, arg_config_file = None, command_line_args = True):
51
51
        """
52
52
        Initialise the configuration dictionary, input, mapper, reducer and
53
53
        output
56
56
        @param arg_reducer Reducer that defines reduce that is acted on map
57
57
                           output
58
58
        @param arg_config_file Configuration file
 
59
        @param command_line_args If set to true, use command line arguments to
 
60
               handle configuration and throw a SystemExit exception if
 
61
               invalid arguments are passed. (Note some third party items, e.g.
 
62
               nosetests, have their own command line arguments that are
 
63
               incompatible with MAUS's)
59
64
        """
60
65
        maus_root_dir = os.environ.get('MAUS_ROOT_DIR')
61
66
        current_dir = os.getcwd()
65
70
            print("WARNING:\tMAUS_ROOT_DIR = %s" % (maus_root_dir))
66
71
            print("WARNING:\tCURRENT DIRECTORY = %s\n" % (current_dir))
67
72
            
68
 
 
69
73
        self.input = arg_input
70
74
        self.mapper = arg_mapper
71
75
        self.reducer = arg_reducer
73
77
 
74
78
        print("Welcome to MAUS:")
75
79
        print(("\tProcess ID (PID): %d" % os.getpid()))
76
 
        print(("\tUniversally Unique ID (UUID): %s" % uuid.uuid4()))
 
80
        # following line is disabled for http://bugs.python.org/issue6059
 
81
        # probably not an issue once patched and line can be available
 
82
        # print(("\tUniversally Unique ID (UUID): %s" % uuid.uuid4()))
77
83
        print(("\tProgram Arguments: %s" % str(sys.argv)))
78
84
 
79
85
        self.json_config_document = \
80
 
                                  Configuration().getConfigJSON(arg_config_file)
 
86
               Configuration().getConfigJSON(arg_config_file, command_line_args)
81
87
        json_config_dictionary = json.loads(self.json_config_document)
82
88
        map_reduce_type = json_config_dictionary['map_reduce_type']
83
89
        version = json_config_dictionary["maus_version"]