コード例 #1
0
ファイル: main.py プロジェクト: wuyou33/explicit_hybrid_mpc
def main():
    """Runs the scheduler for one process, and the worker for all other processes."""
    prepare.set_global_variables()
    if tools.MPI.rank() == global_vars.SCHEDULER_PROC:
        scheduler.main()
    else:
        worker.main()
コード例 #2
0
def index():
    if request.args.get("n"):

        a = request.args.get("n").split(" ")
        url = f"{a[0]}+{a[1]}%20{a[2]}"
        id = a[2]

        if len(url) < 110:
            return jsonify(
                success=False,
                error="Invalid link provided",
                total_screenshot=int(r.get('total_scr')),
                queue_lenght=int(r.get('queue')),
                inspect_link=url,
            )
        else:

            r.incr("queue")
            main(url, id)

            return jsonify(
                success=True,
                total_screenshot=int(r.get('total_scr')),
                queue_lenght=int(r.get('queue')),
                inspect_link=request.args.get("n"),
                image_link=f"http://shibaeo.quetel.pro:5000/image/{id}.png",
            )

    return jsonify(
        success=False,
        error="No inspect link provided",
        total_screenshot=int(r.get('total_scr')),
        queue_lenght=int(r.get('queue')),
    )
コード例 #3
0
ファイル: handleEvents.py プロジェクト: AdamAwan/HomeAuto
def executeEvent(eventID):

    cnx = mysql.connector.connect(user='******', password='******',
                                  host='localhost',
                                  database=configHandler.getDatabaseName())
    cursor = cnx.cursor()
    subQuery = "SELECT * From EventResults WHERE EventID='%s'" % (eventID)
    cursor.execute(subQuery)

    for (ResultID, EventID, EventType, Value, Cond) in cursor:
        print "processing action %s" % (EventType)
        if EventType == "Device":
            main(str(Value), str(Cond))
        if EventType == "TV":
            if (Cond == "Pause"):
                xbmcHandler.pause()
            if (Cond == "Play"):
                xbmcHandler.play()
            if (Cond == "VolUp"):
                xbmcHandler.volUp()
            if (Cond == "VolDown"):
                xbmcHandler.volDown()
コード例 #4
0
ファイル: main.py プロジェクト: dvfess/nmiko
    def run(self):
        while True:
            try:
                host = self.queue.get()
                self.setName(host)
            except Exception:
                break

            try:
                self.result = worker.main(host, config.USER, config.PASSWORD,
                                          cliLog)
                fileLogger.info(self.result)
            except Exception as e:
                fileLogger.critical(e, exc_info=True)
            finally:
                self.queue.task_done()
コード例 #5
0
from moviepy.editor import *
import uuid

config = DevelopmentConfig

if __name__ == '__main__':
    with open(config.CONFIG_PATH + 'images.json', "r") as read_file:
        config.image_map = json.load(read_file)
    with open(config.CONFIG_PATH + 'local_input.json', "r") as read_file:
        config.input_map = json.load(read_file)
    with open(config.LANG_PATH + config.input_map.get('language') + ".json",
              "r") as read_file:
        config.lang_map = json.load(read_file)
    video_obj_arr = []
    for i in range(2, 3):
        if i == 6 and config.input_map.get('mode') != 'store':
            continue
        else:
            video_obj_arr.append(eval('Frame' + str(i))(config))
    _start = time.time()
    txnId = str(uuid.uuid4())
    out_queue = main(video_obj_arr, txnId, len(video_obj_arr) + 1)
    frames = list(out_queue.queue)
    frames.sort(key=lambda x: x[1])
    print(frames)
    final_clip = concatenate_videoclips([frame[0] for frame in frames])
    final_clip.write_videofile(config.SB_VIDEO_PATH_PREFIX +
                               config.input_map.get("fiu") + '-' + txnId +
                               '-' + config.input_map.get('language') + '.mp4',
                               fps=10)
コード例 #6
0
ファイル: worker_tests.py プロジェクト: TooAngel/sensorviewer
 def test_main(self):
     worker.main()
コード例 #7
0
from worker import main
import time

if __name__ == '__main__':
    main()
コード例 #8
0
ファイル: run.py プロジェクト: cloud9ers/j25framework
def runWorker(args, options):
    import worker
    freeze_support()
    sys.argv.pop(0)
    j25.project_directory = HERE
    worker.main("server.ini")
コード例 #9
0
        :param redis_queue_name: the redis queue
        """
        self.redis.lpush('queue:' + redis_queue_name + ':list',
                         packet.SerializeToString())
        self.redis.publish('queue:' + redis_queue_name, '')

    def send_responses(self):
        """Thread to send responses to the client

        We subscribe to a redis queue to get the packets
        the worker wants to send to the client
        """
        pubsub = self.redis.pubsub(ignore_subscribe_messages=True)
        pubsub.subscribe('queue:packetreplies')
        while True:
            response = pubsub.get_message()
            if response is not None:
                packet = packet_pb2.Packet()
                data = response['data']
                packet.ParseFromString(data)

                self.sock.sendto(packet.SerializeToString(),
                                 (packet.address, packet.port))
                print('sent {} bytes to {}'.format(
                    len(packet.SerializeToString()), packet.address))


if __name__ == '__main__':
    import worker
    worker.main()
    ThreadedServer('0.0.0.0', 1234).listen()
コード例 #10
0
ファイル: timerLooper.py プロジェクト: AdamAwan/HomeAuto
    for (DeviceID, Command, MON, TUE, WED, THU, FRI, SAT, SUN) in cursor:
        print "Found one"
        lDeviceID = DeviceID
        lCommand = Command
        lMON = MON
        lTUE = TUE
        lWED = WED
        lTHU = THU
        lFRI = FRI
        lSAT = SAT
        lSUN = SUN

        print "Found timer for DeviceID = %s" % lDeviceID

        if (today == 'Mon' and lMON == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Tue' and lTUE == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Wed' and lWED == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Thu' and lTHU == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Fri' and lFRI == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Sat' and lSAT == 1):
            main(str(lDeviceID), Command)
        elif (today == 'Sun' and lSUN == 1):
            main(str(lDeviceID), Command)

    sleep(60)
コード例 #11
0
def scheduled_job():
    worker.main()
コード例 #12
0
ファイル: clock.py プロジェクト: palindromed/scheduler
def timed_job():
    return_value = main('Curiosity')
    print(return_value)