Ejemplo n.º 1
0
    def __init__(self, arg, command=None):

        full_name, self.path, self.base_name, extension = utils.translate_name(
            arg)

        MultIteratorParser.__init__(self, open(f"{self.base_name}.spg"))
        if command is not None:
            self.command = command

        self.command, ext = os.path.splitext(self.command)

        if not utils.check_params.consistency(self.command, self):
            utils.newline_msg("ERR",
                              "simulation configuration is not consistent.")
            sys.exit(1)

        self.input_configuration = utils.read_input_configuration(
            f"{self.command}.input")

        self.default_parameters = utils.SPGSettings()

        for k, v in self.input_configuration.items():

            if v.var_type != "str":
                self.default_parameters[k] = eval(f"{v.var_type}({v.default})")
            else:
                self.default_parameters[k] = v.default

        self.stdout_configuration = utils.read_output_configuration(
            self.command)
Ejemplo n.º 2
0
    def __init__(self, db_name, timeout=5):
        full_name, self.path, self.base_name, extension = utils.translate_name(
            db_name)

        self.db_name = "%s/%s.spgql" % (self.path, self.base_name)
        sim_name = "%s/%s.spg" % (self.path, self.base_name)

        MultIteratorParser.__init__(self, open(sim_name))
        #   print self.data
        # self.path, foo = os.path.split( os.path.abspath(db_name) )
        # self.base_name, foo = os.path.splitext( foo )
        #    print  check_params.consistency(self.command, self)
        if not check_params.consistency(self.command, self):
            utils.newline_msg("ERR",
                              "simulation configuration is not consistent.")
            sys.exit(1)

        all_outputs = check_params.read_output_configuration(self.command)

        self.stdout_contents = dict()
        for k in all_outputs:
            table = k.output_table
            if table not in self.stdout_contents.leys():
                self.stdout_contents[table] = k

        self.connection = sql.connect(self.db_name,
                                      timeout=timeout,
                                      check_same_thread=False)
        self.cursor = self.connection.cursor()
Ejemplo n.º 3
0
 def __init__(self, stream=None, db_name = "results.sqlite", timeout = 5):
     MultIteratorParser.__init__(self, stream)
 #    print  check_params.consistency(self.command, self)
     if not check_params.consistency(self.command, self):
         utils.newline_msg("ERR","parameters.dat file is not consistent.")
         sys.exit(1)
     self.stdout_contents = check_params.contents_in_output(self.command)
             
     self.connection =  sql.connect(db_name, timeout = timeout)
     self.cursor = self.connection.cursor()
Ejemplo n.º 4
0
    def __init__(self, db_name , timeout = 5):
        full_name, self.path, self.base_name, extension = utils.translate_name( db_name )

        self.db_name = "%s/%s.spgql"%(self.path, self.base_name)
        sim_name = "%s/%s.spg"%(self.path, self.base_name)

        MultIteratorParser.__init__(self, open(sim_name) )
        # self.path, foo = os.path.split( os.path.abspath(db_name) )
        # self.base_name, foo = os.path.splitext( foo )
    #    print  check_params.consistency(self.command, self)
        if not check_params.consistency(self.command, self):
            utils.newline_msg("ERR","simulation configuration is not consistent.")
            sys.exit(1)

        self.stdout_contents = check_params.contents_in_output(self.command)
                
        self.connection =  sql.connect(self.db_name, timeout = timeout, check_same_thread = False)
        self.cursor = self.connection.cursor()