コード例 #1
0
ファイル: assimilator.py プロジェクト: oXis/bin_boinc
 def __init__(self):
     # Be sure to call Assimilator.__init__(self) from child classes
     
     # HACK: this belongs in boinc_db.py!
     boinc_db.WU_ERROR_NO_CANONICAL_RESULT = 32
     
     # initialize member vars
     self.config = None
     self.STOP_TRIGGER_FILENAME = boinc_project_path.project_path('stop_daemons')
     self.caught_sig_int = False
     self.log=sched_messages.SchedMessages()
     self.pass_count = 0
     self.update_db = True
     self.noinsert = False
     self.wu_id_mod = 0
     self.wu_id_remainder = 0
     self.one_pass = False
     self.one_pass_N_WU = 0
     self.appname = ''
     self.sleep_interval = 10
     self.path = "/home/boinc/findah/assimilated/"
     self.failedPath = "/home/boinc/findah/failed/"
     self.pendingPath = "/home/boinc/findah/pending/"
     self.num_thread = 0
     self.pass_modulo = 300
     self.conn = None
コード例 #2
0
        def assimilate_handler(self, wu, results, canonical_result):
                if canonical_result == None:
                        return
                path = boinc_project_path.project_path("kaktoos_results")
                input_path = self.get_file_path(canonical_result)
                heightmatch = re_name.search(canonical_result.name)
                height = heightmatch.group(1)
                filename = "results_" + height + ".txt"
                input_str = ""
                try:
                    with open(input_path) as input_file:
                        input_str = input_file.read()
                except (OSError,IOError) as e:
                    self.logCritical("Unable to open input file: %s\n", e.filename)

                try:
                    os.makedirs(path)
                except (OSError,IOError) as e:
                    self.logCritical("Unable to create output directory: %s\n", e.filename)

                try:
                    with open(os.path.join(path, filename), "a") as f:
                        for match in re_result.finditer(input_str):
                            f.write("{}\n".format(match.group(1)))
                except (OSError,IOError) as e:
                    self.logCritical("Unable to write to output file: %s\n", e.filename)
コード例 #3
0
 def assimilate_handler(self, wu, results, canonical_result):
     chunkseed = re_unit.search(wu.xml_doc).group(1)
     path = boinc_project_path.project_path("kaktwoos_results")
     try:
         os.makedirs(path)
     except OSError:
         pass
     with open(os.path.join(path, "results.txt"), "a") as f:
         for match in re_result.finditer(canonical_result.stderr_out):
             f.write("{} {}\n".format(chunkseed, match.group(1)))
コード例 #4
0
def check_stop_trigger():
    """
    Checks whether a stop trigger is present and closes at a good time
    if one is.
    """

    try:
        junk = open(boinc_project_path.project_path('stop_daemons'), 'r')
        return True
    except IOError:
        if CAUGHT_SIGINT:
            return True
    return False
コード例 #5
0
def check_stop_trigger():
    """
    Checks whether a stop trigger is present and closes at a good time
    if one is.
    """

    try:
        junk = open(boinc_project_path.project_path('stop_daemons'), 'r')
        return True
    except IOError:
        if CAUGHT_SIGINT:
            return True
    return False
コード例 #6
0
    def assimilate_handler(self, wu, results, canonical_result):
        if canonical_result == None:
            return
        path = boinc_project_path.project_path("trailertcrack_results")
        input_path = self.get_file_path(canonical_result)

        with open(input_path) as input_file:
            input_str = input_file.read()

        try:
            os.makedirs(path)
        except OSError:
            pass
        with open(os.path.join(path, "results.txt"), "a") as f:
            for match in re_result.finditer(input_str):
                f.write("{}\n".format(match.group(1)))
コード例 #7
0
    def assimilate_handler(self, wu, results, canonical_result):
        if canonical_result == None:
            return
        out_path = boinc_project_path.project_path("download/results/prines")
        in_path = self.get_file_path(canonical_result)

        with open(in_path) as in_file:
            in_str = in_file.read()

        try:
            os.makedirs(out_path)
        except OSError:
            pass

        with open(os.path.join(out_path, "prines_results.txt"),
                  "a") as out_file:
            out_file.write(in_str)
コード例 #8
0
    def assimilate_handler(self, wu, results, canonical_result):
        if canonical_result == None:
            return
        
        path = boinc_project_path.project_path("paintingcrack_results")
        input_path = self.get_file_path(canonical_result)

        with open(input_path) as input_file:
            input_str = input_file.read()

        try:
            os.makedirs(path)
        except OSError:
             pass
        
        center_coords = file_re_result.findall(input_str)[0]

        with open(os.path.join(path, "results.txt"), "a") as f:
		    for match in re_result.finditer(input_str):
                f.write("Center: {}, seed: {}\n".format(center_coords, match.group(1)))
コード例 #9
0
ファイル: assimilator.py プロジェクト: sahlu/boinc-magphys
    def __init__(self):
        # Be sure to call Assimilator.__init__(self) from child classes

        # HACK: this belongs in boinc_db.py!
        boinc_db.WU_ERROR_NO_CANONICAL_RESULT = 32

        # initialize member vars
        self.config = None
        self.STOP_TRIGGER_FILENAME = boinc_project_path.project_path(
            'stop_daemons')
        self.caught_sig_int = False
        self.log = sched_messages.SchedMessages()
        self.pass_count = 0
        self.update_db = True
        self.noinsert = False
        self.wu_id_mod = 0
        self.wu_id_remainder = 0
        self.one_pass = False
        self.one_pass_N_WU = 0
        self.appname = ''
        self.sleep_interval = 10
コード例 #10
0
    def assimilate_handler(self, wu, results, canonical_result):
        if canonical_result == None:
            return
        chunkseed = re_unit.search(wu.xml_doc).group(1)
        path = boinc_project_path.project_path("kaktwoos_results")
        heightmatch = re_name.search(canonical_result.name)
        height = heightmatch.group(1)
        filename = "results_y" + height + ".txt"
        try:
            os.makedirs(path)
        except (OSError, IOError) as e:
            self.logCritical("Unable to create output directory: %s\n",
                             e.filename)

        try:
            with open(os.path.join(path, filename), "a") as f:
                for match in re_result.finditer(canonical_result.stderr_out):
                    f.write("{} {}\n".format(chunkseed, match.group(1)))
        except (OSError, IOError) as e:
            self.logCritical("Unable to write to output file: %s\n",
                             e.filename)
コード例 #11
0
    def assimilate_handler(self, wu, results, canonical_result):
        try:
            if canonical_result == None:
                return

            path = boinc_project_path.project_path("onechunk_results")
            input_path = self.get_file_path(canonical_result)

            with open(input_path) as input_file:
                input_str = input_file.read()

            try:
                os.makedirs(path)
            except OSError:
                pass

            lines = set()
            with open(os.path.join(path, "results.txt"), "a") as f:
                for line in input_str.splitlines():
                    lines.add(line)
                for line in lines:
                    f.write("{}\n".format(line))
        except Exception as e:
            print(e)
コード例 #12
0
from socket import socket, timeout
import argparse
import struct
import cPickle
import logging
import logging.handlers
import signal
from Boinc import boinc_project_path
from threading import Thread
from multiprocessing import Process
import time
from config import LOGGER_SERVER_PORT, LOGGER_LOG_DIRECTORY, LOGGER_MAX_CONNECTION_REQUESTS
from utils.logging_helper import config_logger

STOP_TRIGGER_FILENAME = boinc_project_path.project_path('stop_daemons')

# A list of all child processes (entries added whenever a client connects and removed on disconnect)
child_list = list()

# Set to true when a SIGINT OR SIGHUP is caught
caught_sig_int = False

# Local logger for server logs
server_log = config_logger('ServerLog')
handler = logging.FileHandler('ServerLog.log')
formatter = logging.Formatter('%(asctime)-15s:' + logging.BASIC_FORMAT)
handler.setFormatter(formatter)
server_log.addHandler(handler)

コード例 #13
0
from socket import socket, timeout
import argparse
import struct
import cPickle
import logging
import logging.handlers
import signal
from Boinc import boinc_project_path
from threading import Thread
from multiprocessing import Process
import time
from config import LOGGER_SERVER_PORT, LOGGER_LOG_DIRECTORY, LOGGER_MAX_CONNECTION_REQUESTS
from utils.logging_helper import config_logger

STOP_TRIGGER_FILENAME = boinc_project_path.project_path('stop_daemons')

# A list of all child processes (entries added whenever a client connects and removed on disconnect)
child_list = list()

# Set to true when a SIGINT OR SIGHUP is caught
caught_sig_int = False

# Local logger for server logs
server_log = config_logger('ServerLog')
handler = logging.FileHandler('ServerLog.log')
formatter = logging.Formatter('%(asctime)-15s:' + logging.BASIC_FORMAT)
handler.setFormatter(formatter)
server_log.addHandler(handler)