Beispiel #1
0
def spawnfunc(i, child, funcobj):
    import difxlog as log
    if i == 0:
        log.debug(child.before)
        return 0
    if i == 1:
        return 1
Beispiel #2
0
def spawn_func(i, child, funcobj):
    if i == 0:
        start_time, exec_time = funcobj
        log.debug(child.before)
        a = retimestep.match(child.before)
        if a:
            timestep = int(a.group(2))
            realtime = int(100. * timestep / (time() - start_time))
            log.info(''.join(
                ('Timestep ', a.group(2), ' / ', exec_time, '.  ',
                 str(timestep * 100 / int(exec_time)), '% completed in ',
                 str(realtime), '% realtime.')))
        return 0
    # Could add some other regexps for detecting errors etc.
    # returning 2 or something like that
    if i == 1:
        return 1
Beispiel #3
0
def get_comments(logfile):
    """
    Get comments from logfile where logfile is an open file object.
    """
    times = []
    comments = []
    #first find out how the file is structured

    logfile.seek(0)
    log.debug('relevant lines from ' + sys.argv[1])
    for line in logfile:
        for s in searchstring:
            if s in line:
                #n.b. this is ignoring fractional part of the second but that probably doesn't matter
                t = datetime(*strptime(line[:17], "%Y.%j.%H:%M:%S")[0:6])
                us = timedelta(0, 0, int(line[18:20]) * 10000)
                times.append(t + us)
                line = line.strip()
                line = line.split(s)
                comments.append(" ".join(line[1:]))
    return times, comments
Beispiel #4
0
 def run(self, i):
     if i == 0:
         log.debug(self.child.before)
         a = retimestep.match(self.child.before)
         if a:
             this_time = time()
             this_timestep = float(a.group(2))
             if self.last_timestep == -1:
                 realtime = 0
                 time_elapsed = 0
                 current_realtime = 0
                 time_remaining = 0
             else:
                 realtime = (this_timestep / (this_time - self.start_time))
                 if realtime == 0:
                     realtime = 1
                 time_elapsed = this_time - self.start_time
                 current_realtime = self.int_time / (this_time -
                                                     self.last_time)
                 time_remaining = (self.exec_time -
                                   this_timestep) / realtime
             time_elapsed_str = "%3d:%02d:%02.0f" % df2hhms(
                 (time_elapsed + 0.5) / 86400.)
             time_remaining_str = "%3d:%02d:%02.0f" % df2hhms(
                 (time_remaining + 0.5) / 86400.)
             fullstring = "Completed %9.2f/%9.2fs(%2.0f%%)|Elapsed %s|Remaining %s|%3.0f%%" %\
                   (this_timestep,
                    self.exec_time,
                    100.0 * this_timestep / self.exec_time,
                    time_elapsed_str,
                    time_remaining_str,
                    100.0 * current_realtime + 0.5)
             log.info(fullstring)
             self.last_time = this_time
             self.last_timestep = this_timestep
         return 0
     # Could add some other regexps for detecting errors etc.
     # returning 2 or something like that
     if i == 1:
         return 1
Beispiel #5
0
 def run(self, i):
     if i == 0:
         log.debug(self.child.before)
         return 0
     if i == 1:
         return 1