コード例 #1
0
    def __init__(self) -> None:
        super().__init__(title="Process Manager")
        self.connect("destroy", Gtk.main_quit)
        self.set_border_width(5)

        self.expropiated_process: Process = None
        self.process_manager = ProcessManager()
        self.timeout_id = None

        self.init_components()
コード例 #2
0
    def pick_file_or_directory(self, multi=False):
        """
        Pop-up a file selection window.

        :param multi: Boolean Allow selecting multiple elements.
        :returns: List of files that were selected with file browser.
        """
        files = ProcessManager.pick_file_or_directory(self, multi)
        files = [f.replace("/", "\\") for f in files]
        # Qt returns files with / while the javascript code expects paths on Windows to use \
        return files
コード例 #3
0
ファイル: daq_controller.py プロジェクト: sfuphantom/DAQ
    def __init__(self, testmode=False):
        self.process_manager = ProcessManager(self)
        self.data_queue = Queue()
        self.state = SystemState['ACTIVE']

        if testmode == False:
            self._i2c = i2c_handler(self)
            self._gps = gps_handler(self)
        else:
            daq_tester = DaqTester(self)
            print("Test mode engaged")

        self.mqtt = MqttHandler(DASHBOARD_NAME, MQTT_BROKER_IP, self)
コード例 #4
0
    def __init__(self):
        self.my_shell = Shell()
        self.my_file_manager = FileManager(Config.storage_block_size,
                                           Config.storage_track_num,
                                           Config.storage_sec_num)
        self.my_memory_manager = MemoryManager(
            mode=Config.memory_management_mode,
            page_size=Config.memory_page_size,
            page_number=Config.memory_page_number,
            physical_page=Config.memory_physical_page_number)
        self.my_process_manager = ProcessManager(self.my_memory_manager)

        self.is_monitoring = False
        # start process manager
        self.my_process_manager_run_thread = threading.Thread(
            target=self.my_process_manager.start_manager)
        self.my_process_manager_run_thread.start()

        # printer Threading
        self.IOdevice_thread = threading.Thread(
            target=self.my_process_manager.io_device_handler)
        self.IOdevice_thread.start()
コード例 #5
0
def execute_task(proc_settings_manager, mon_settings_manager):
    active_monitor_name = get_active_monitor_name()
    process_manager = ProcessManager()
    interval_counter = 0
    while True:
        proc_cache_refresh_rate = mon_settings_manager.get_process_cache_refresh_rate(
        )
        interval_secs = mon_settings_manager.get_interval_setting()
        if (interval_counter >= proc_cache_refresh_rate):
            process_manager.refresh_cache()
            interval_counter = 0
        time.sleep(interval_secs)
        proc_settings = proc_settings_manager.get_settings()
        prev_monitor_name = active_monitor_name
        active_monitor_name = get_active_monitor_name()
        if prev_monitor_name != active_monitor_name:
            handle_active_monitor_change(
                prev_monitor_name,
                active_monitor_name,
                proc_settings,
                process_manager,
            )
        interval_counter += 1
コード例 #6
0
def worker():
    logging.debug('Starting worker')
    while True:
        QueueManager.print_val()
        req = QueueManager.deque()
        time.sleep(10)
        to_message = req.args.get('to')
        if to_message == "COUNTER":
            ProcessManager.process_counter_request(req)
        elif to_message == "CUSTOMER":
            ProcessManager.process_customer_request(req)
        elif to_message == "COOK":
            ProcessManager.process_cook_request(req)
        elif to_message == "ANNOUNCER":
            ProcessManager.process_announcer_request(req)
    logging.debug('Exiting worker')
コード例 #7
0
def worker():
    logging.debug('Starting worker')
    while True:
        QueueManager.print_val()
        req = QueueManager.deque()
        time.sleep(10)
        to_message = req.args.get('to')
        if to_message == "COUNTER":
            ProcessManager.process_counter_request(req)
        elif to_message == "CUSTOMER":
            ProcessManager.process_customer_request(req)
        elif to_message == "COOK":
            ProcessManager.process_cook_request(req)
        elif to_message == "ANNOUNCER":
            ProcessManager.process_announcer_request(req)
    logging.debug('Exiting worker')
コード例 #8
0
import requests

from flask import Flask, request, jsonify
from bot_request_manager import BotRequestManager

from process_manager import ProcessManager

app = Flask(__name__)

process_manager = ProcessManager()

@app.route('/webhook', methods=['POST'])
def index():

  req = request.get_json()

  request_manager = BotRequestManager(req)

  success = request_manager.get_result(process_manager)

  return jsonify(success = success)

""" Initializes the webhook
Args:
  url:str -> Provides the telegram server with a endpoint for webhook data """
def init_webhook(url):    

  requests.get(url)
コード例 #9
0
from template_processor import TemplateProcessor

cwd = os.getcwd()
args = parse()
config = JsonConfigReader([JsonConfigValidator()]).read(file_name=args.config)
terraform_directory = args.terraform_directory
ansible_directory = args.ansible_directory
mode = TerraformMode.APPLY.value if args.mode == 'apply' else TerraformMode.DESTROY.value

output_parameters_path = os.path.join(terraform_directory, 'parameters.tfvars')
template_processor = TemplateProcessor('utils/parameters.j2',
                                       output_parameters_path)
template_processor.process(config)

status_code = ProcessManager('terraform').with_cwd(args.terraform_directory)\
    .with_args(mode, '-var-file="parameters.tfvars"', '-auto-approve')\
    .start(lambda data: print(data)).wait()
print(f'Terraform status code {status_code}')

if status_code == 0 and mode == TerraformMode.APPLY.value:
    configuration = Configuration(config)
    tenant_id = configuration.azure.tenant_id
    client_id = configuration.azure.client_id
    client_secret = configuration.azure.client_secret

    inventory_creator = InventoryCreator(AzureHttpClient(), configuration)
    inventory = inventory_creator.create(
        AuthorizationDto(tenant_id, client_id, client_secret))
    inventory_writer = InventoryWriter('swarm_inventory')
    inventory_writer.save(inventory)
    print('Inventory created')
コード例 #10
0
from werkzeug.wrappers import Request, Response
from jsonrpc import JSONRPCResponseManager, dispatcher
from process_manager import ProcessManager


@Request.application
def application(request: Request):

    response = JSONRPCResponseManager.handle(request.data, dispatcher)

    return Response(response.json, mimetype='application/json')


if __name__ == '__main__':
    from werkzeug.serving import run_simple

    process_manager = ProcessManager('processes.json')

    dispatcher['list_processes'] = process_manager.list_processes
    dispatcher['get_metrics'] = process_manager.get_metrics
    dispatcher['start_process'] = process_manager.start_process
    dispatcher['kill'] = process_manager.kill
    dispatcher['terminate'] = process_manager.terminate
    dispatcher['restart_process'] = process_manager.restart_process

    run_simple('localhost', 8000, application)
コード例 #11
0
class Kernel:
    def __init__(self):
        self.my_shell = Shell()
        self.my_file_manager = FileManager(Config.storage_block_size,
                                           Config.storage_track_num,
                                           Config.storage_sec_num)
        self.my_memory_manager = MemoryManager(
            mode=Config.memory_management_mode,
            page_size=Config.memory_page_size,
            page_number=Config.memory_page_number,
            physical_page=Config.memory_physical_page_number)
        self.my_process_manager = ProcessManager(self.my_memory_manager)

        self.is_monitoring = False
        # start process manager
        self.my_process_manager_run_thread = threading.Thread(
            target=self.my_process_manager.start_manager)
        self.my_process_manager_run_thread.start()

        # printer Threading
        self.IOdevice_thread = threading.Thread(
            target=self.my_process_manager.io_device_handler)
        self.IOdevice_thread.start()

        # signal.signal(signal.SIGINT, self.my_shell.deblock)

    # monitoring all resources
    def monitoring(self, interval=1):
        self.is_monitoring = True
        self.my_file_manager.disk.disk_monitoring = True
        while self.is_monitoring:
            self.my_process_manager.resource_monitor()
            self.my_memory_manager.memory_watching()
            self.my_file_manager.draw_disk_speed()
            sleep(interval)

    def report_error(self, cmd, err_msg=''):
        print('[error %s] %s' % (cmd, err_msg))
        if err_msg == '':
            self.display_command_description(cmd_list=[cmd])

    # command: man [cmd1] [cmd2] ...
    def display_command_description(self, cmd_list):
        command_to_description = {
            'man': 'manual page, format: man [command1] [command2] ...',
            'ls': 'list directory contents, format: ls [-a|-l|-al] [path]',
            'cd': 'change current working directory, format: cd [path]',
            'rm':
            'remove file or directory recursively, format: rm [-r|-f|-rf] path',
            'mkdir': 'create directory, format: mkdir path',
            'mkf':
            'create common file, format: mkf path type size, e.g. mkf my_file crwx 300',
            'dss': 'display storage status, format: dss',
            'dms': 'display memory status, format: dms',
            'exec': 'execute file, format: exec path, e.g. exec test',
            'chmod':
            'change mode of file, format: chmod path new_mode, e.g. chmod test erwx',
            'ps': 'display process status, format: ps',
            'rs': 'display resource status, format: rs',
            'mon':
            'start monitoring system resources, format: mon [-o], use -o to stop',
            'td': 'tidy and defragment your disk, format: td',
            'kill': 'kill process, format: kill pid',
            'exit': 'exit MiniOS'
        }
        if len(cmd_list) == 0:
            cmd_list = command_to_description.keys()
        for cmd in cmd_list:
            if cmd in command_to_description.keys():
                print(cmd, '-', command_to_description[cmd])
            else:
                self.report_error(cmd=cmd, err_msg='no such command')

    def run(self):
        while True:
            # a list of commands split by space or tab
            current_file_list = self.my_file_manager.ls(method='get')
            command_split_list = self.my_shell.get_split_command(
                cwd=self.my_file_manager.current_working_path,
                file_list=current_file_list)

            # this indicates user push Enter directly, then nothing to happen
            if len(command_split_list) == 0:
                continue

            for command_split in command_split_list:
                if len(command_split) == 0:  # an empty command
                    continue

                tool = command_split[0]  # tool name, e.g. ls, cd, ...

                argc = len(command_split)  # argument count

                if tool == 'man':
                    self.display_command_description(
                        cmd_list=command_split[1:])

                elif tool == 'ls':
                    if argc >= 2:
                        if command_split[1][0] == '-':
                            mode = command_split[1]
                            path_list = command_split[2:]
                            if len(path_list) == 0:
                                path_list = ['']
                        else:
                            mode = ''
                            path_list = command_split[1:]
                        for path in path_list:
                            self.my_file_manager.ls(dir_path=path, mode=mode)
                    else:
                        self.my_file_manager.ls()

                elif tool == 'cd':
                    if argc >= 2:
                        self.my_file_manager.cd(dir_path=command_split[1])
                    else:
                        self.my_file_manager.cd(dir_path=os.sep)

                elif tool == 'rm':
                    if argc >= 2:
                        if command_split[1][0] == '-':
                            mode = command_split[1]
                            path_list = command_split[2:]
                            if len(path_list) == 0:
                                self.report_error(cmd=tool)
                        else:
                            mode = ''
                            path_list = command_split[1:]
                        for path in path_list:
                            self.my_file_manager.rm(file_path=path, mode=mode)
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'chmod':
                    if argc >= 3:
                        self.my_file_manager.chmod(file_path=command_split[1],
                                                   file_type=command_split[2])
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'mkf':
                    if argc >= 4:
                        self.my_file_manager.mkf(file_path=command_split[1],
                                                 file_type=command_split[2],
                                                 size=command_split[3])
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'mkdir':
                    if argc >= 2:
                        for path in command_split[1:]:
                            self.my_file_manager.mkdir(dir_path=path)
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'dss':
                    self.my_file_manager.display_storage_status()

                elif tool == 'dms':
                    self.my_memory_manager.display_memory_status()
                    # self.my_shell.block(func=self.my_memory_manager.display_memory_status)

                elif tool == 'exec':
                    if argc >= 2:
                        path_list = command_split[1:]
                        for path in path_list:
                            my_file = self.my_file_manager.get_file(
                                file_path=path, seek_algo=Config.seek_algo)
                            if my_file:
                                if my_file['type'][3] == 'x':
                                    self.my_process_manager.create(
                                        exefile=my_file)
                                else:
                                    self.report_error(
                                        cmd=tool,
                                        err_msg='no execution permission')
                            else:
                                self.report_error(cmd=tool)
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'ps':
                    self.my_process_manager.print_process_status()
                    # self.my_shell.block(func=self.my_process_manager.process_status)

                elif tool == 'rs':
                    self.my_process_manager.print_resource_status()
                    # self.my_shell.block(func=self.my_process_manager.resource_status)

                elif tool == 'mon':
                    if argc >= 2 and command_split[1] == '-o':
                        print('Stop monitoring')
                        self.is_monitoring = False
                        self.my_file_manager.disk.disk_monitoring = False
                    else:
                        # start monitoring
                        print('Start monitoring')
                        monitor_thread = threading.Thread(
                            target=self.monitoring)
                        monitor_thread.daemon = True
                        monitor_thread.start()

                elif tool == 'td':
                    self.my_file_manager.tidy_disk()

                elif tool == 'kill':
                    if argc >= 2:
                        for pid in command_split[1:]:
                            pid_to_kill = int(pid)
                            kill_res = self.my_process_manager.kill(
                                pid=pid_to_kill)
                            if kill_res:
                                self.my_memory_manager.free(pid=pid_to_kill)
                    else:
                        self.report_error(cmd=tool)

                elif tool == 'exit':
                    self.my_process_manager.is_running = False
                    exit(0)

                else:
                    self.report_error(cmd=tool, err_msg='no such command')
コード例 #12
0
def start_thread():
    ProcessManager.__init__()
    w = threading.Thread(name='worker', target=worker)
    w.start()
コード例 #13
0
class ProcessManagerWindow(Gtk.Window):
    # __________________________________________________________________________
    def __init__(self) -> None:
        super().__init__(title="Process Manager")
        self.connect("destroy", Gtk.main_quit)
        self.set_border_width(5)

        self.expropiated_process: Process = None
        self.process_manager = ProcessManager()
        self.timeout_id = None

        self.init_components()

    # __________________________________________________________________________
    def init_components(self) -> None:
        grid = Gtk.Grid(
            row_homogeneous=True,
            column_homogeneous=True,
            row_spacing=5,
            column_spacing=5,
        )

        # Simulate Switch ------------------------------------------------------
        top_box = Gtk.Box(spacing=2)

        self.simulating_label = Gtk.Label(label="Start Simulating")
        self.simulating_switch = Gtk.Switch()
        self.simulating_switch.set_active(False)
        self.simulating_switch.connect("notify::active",
                                       self.execute_simulation)
        self.executing_spinner = Gtk.Spinner()
        self.quantum_rat_spin_button = Gtk.SpinButton(
            adjustment=Gtk.Adjustment(value=750,
                                      lower=125,
                                      upper=10000,
                                      step_increment=125,
                                      page_increment=0,
                                      page_size=0),
            climb_rate=1,
            digits=0,
        )
        self.quantum_rat_spin_button.connect("value-changed",
                                             self.change_quantum_rat)

        # Inactive Processes List ----------------------------------------------
        self.inactive_processes_list_box = Gtk.ListBox()
        self.inactive_processes_list_box.set_selection_mode(
            Gtk.SelectionMode.NONE)
        inactive_processes_scrolled_window = Gtk.ScrolledWindow()
        inactive_processes_scrolled_window.add(
            self.inactive_processes_list_box)

        for i in self.process_manager.inactive_processes:
            process_button = Gtk.Button(label=i.name)
            process_button.connect("clicked", self.prepare_process_action)
            self.inactive_processes_list_box.add(process_button)

        add_process_button = Gtk.Button(label="Add Process")
        add_process_button.connect("clicked", self.add_process_action)

        # Prepared Processes List ----------------------------------------------
        self.prepared_processes_list_box = Gtk.ListBox()
        self.prepared_processes_list_box.set_selection_mode(
            Gtk.SelectionMode.NONE)
        prepared_processes_scrolled_window = Gtk.ScrolledWindow()
        prepared_processes_scrolled_window.add(
            self.prepared_processes_list_box)

        # Executed Process Progress Bar ----------------------------------------
        self.executed_process_list_box = Gtk.ListBox()
        self.executed_process_list_box.set_selection_mode(
            Gtk.SelectionMode.NONE)
        executed_process_scrolled_window = Gtk.ScrolledWindow()
        executed_process_scrolled_window.add(self.executed_process_list_box)

        # Suspended Processes List ---------------------------------------------
        self.suspended_processes_list_box = Gtk.ListBox()
        self.suspended_processes_list_box.set_selection_mode(
            Gtk.SelectionMode.NONE)
        suspended_processes_scrolled_window = Gtk.ScrolledWindow()
        suspended_processes_scrolled_window.add(
            self.suspended_processes_list_box)

        # Add Components -------------------------------------------------------
        top_box.add(Gtk.Label(label='Quantum Rat (ms):'))
        top_box.add(self.quantum_rat_spin_button)
        top_box.add(self.simulating_label)
        top_box.add(self.simulating_switch)
        top_box.add(self.executing_spinner)

        grid.attach(top_box, 0, 0, 3, 1)

        grid.attach(Gtk.Label(label="Inactive Processes"), 0, 1, 1, 1)
        grid.attach(inactive_processes_scrolled_window, 0, 2, 1, 15)
        grid.attach(add_process_button, 0, 17, 1, 1)

        grid.attach(Gtk.Label(label="Prepared Processes"), 1, 1, 3, 1)
        grid.attach(prepared_processes_scrolled_window, 1, 2, 3, 16)

        grid.attach(Gtk.Label(label="Executed Process"), 4, 1, 3, 1)
        grid.attach(executed_process_scrolled_window, 4, 2, 3, 1)

        grid.attach(Gtk.Label(label="Suspended Processes"), 4, 3, 3, 1)
        grid.attach(suspended_processes_scrolled_window, 4, 4, 3, 14)

        self.update_components()
        self.add(grid)

    # __________________________________________________________________________
    def update_components(self) -> None:
        # Add Prepared Processes -----------------------------------------------
        self.remove_list_box(self.process_manager.prepared_processes,
                             self.prepared_processes_list_box)
        for i in self.process_manager.prepared_processes:
            process_progress_bar = ProcessProgressBar(i)

            flag = True
            for j in self.prepared_processes_list_box.get_children():
                if j.process == i:
                    flag = False
                    break
            if flag:
                self.prepared_processes_list_box.add(Row(process_progress_bar))

        # Add Executed Processes -----------------------------------------------
        executed_process = self.process_manager.executed_process
        self.clear_list_box(self.executed_process_list_box)
        if executed_process:
            process_progress_bar = ProcessProgressBar(executed_process)
            self.executed_process_list_box.add(process_progress_bar)

        # Add Suspended Processes ----------------------------------------------
        self.remove_list_box(self.process_manager.suspended_processes,
                             self.suspended_processes_list_box)
        for i in self.process_manager.suspended_processes:
            process_progress_bar = ProcessProgressBar(i)

            flag = True
            for j in self.suspended_processes_list_box.get_children():
                if j.process == i:
                    flag = False
                    break
            if flag:
                self.suspended_processes_list_box.add(
                    Row(process_progress_bar))

        # Update lists components ----------------------------------------------
        self.inactive_processes_list_box.show_all()
        self.prepared_processes_list_box.show_all()
        self.executed_process_list_box.show_all()
        self.suspended_processes_list_box.show_all()

    # __________________________________________________________________________
    def remove_list_box(self, processes_list, list_box):
        for i in list_box.get_children():
            if i.process not in processes_list:
                i.destroy()

    # __________________________________________________________________________
    def clear_list_box(self, list_box) -> None:
        for i in list_box.get_children():
            i.destroy()

    # __________________________________________________________________________
    def execute_simulation(self, switch, _):
        f = self.complete_execution if self.expropiated_process else self.iteration

        if self.timeout_id:
            GLib.source_remove(self.timeout_id)
        del self.timeout_id
        self.timeout_id = None

        if switch.get_active():
            self.timeout_id = GLib.timeout_add(
                self.process_manager.quantum_rat * 1000, f, None)
            self.executing_spinner.start()
            self.simulating_label.set_label("Stop Simulating")
        else:
            self.executing_spinner.stop()
            self.simulating_label.set_label("Start Simulating")

    # __________________________________________________________________________
    def change_quantum_rat(self, spin_button):
        quantum_rat = spin_button.get_value_as_int()
        self.process_manager.set_quantum_rat(quantum_rat / 1000)

    # __________________________________________________________________________
    def add_process_action(self, _) -> None:
        add_process_message_dialog = Gtk.MessageDialog(
            parent=None,
            title="Add New Process",
            text="Process Name:",
            secondary_text="Empty name will not be added",
            buttons=Gtk.ButtonsType.OK_CANCEL,
        )

        process_name_entry = Gtk.Entry()
        add_process_message_dialog.get_content_area().pack_end(
            process_name_entry, True, True, 0)

        add_process_message_dialog.show_all()
        response = add_process_message_dialog.run()
        process_name = process_name_entry.get_text()
        add_process_message_dialog.destroy()

        if process_name and response == Gtk.ResponseType.OK:
            self.process_manager.add_process(process_name)
            process_button = Gtk.Button(label=process_name)
            process_button.connect("clicked", self.prepare_process_action)
            self.inactive_processes_list_box.add(process_button)
            self.update_components()

    # __________________________________________________________________________
    def prepare_process_action(self, button) -> None:
        process = self.process_manager.prepare_process(button.get_label())
        if process:
            print("+ prepare:", process.__str__(True))

            if (process.priority == Process.PRIORITIES[0]
                    and not self.expropiated_process):
                self.expropiation(process)

            self.update_components()
        else:
            show_error_message_error = Gtk.MessageDialog(
                parent=None,
                title="Can not execute more processes",
                text="Error:",
                secondary_text="Can not execute more processes\n"
                "Processes Limit: 999",
                buttons=Gtk.ButtonsType.OK_CANCEL,
            )
            show_error_message_error.run()
            show_error_message_error.destroy()

    # __________________________________________________________________________
    def execute_process_action(self, process) -> None:
        if process:
            print("* execute:", process.__str__(True))
            self.process_manager.execute_process(process)
            self.update_components()

    # __________________________________________________________________________
    def deactivate_process_action(self) -> None:
        process = self.process_manager.deactivate_process()
        print("- deactivate:", process.__str__(True))
        self.update_components()

    # __________________________________________________________________________
    def suspend_process_action(self) -> None:
        process = self.process_manager.suspend_process()
        print("/ suspend:", process.__str__(True))
        self.update_components()

    # __________________________________________________________________________
    def iteration(self, _) -> bool:
        # Suspended to prepared
        i = 0
        while i < len(self.process_manager.suspended_processes):
            process = self.process_manager.suspended_processes[0]
            if hasattr(process, 'next') and process.next:
                delattr(process, 'next')
                self.process_manager.suspended_processes.remove(process)
                self.process_manager.prepared_processes.append(process)
            elif process.interaction:
                process.next = True
                i += 1
            else:
                self.process_manager.suspended_processes.remove(process)
                self.process_manager.prepared_processes.append(process)

        # Executed to suspended or deactivated
        executed_process = self.process_manager.executed_process
        if executed_process:
            executed_process.progress += executed_process.advance
            if executed_process.progress >= 1:
                self.deactivate_process_action()
            else:
                self.suspend_process_action()

        # Prepared to executed
        process_to_execute = self.process_manager.compete()
        self.execute_process_action(process_to_execute)

        return self.expropiated_process == None

    # __________________________________________________________________________
    def expropiation(self, process: Process) -> None:
        executed = self.process_manager.executed_process
        if executed:
            self.process_manager.prepared_processes.append(executed)
            self.process_manager.execute_process(process)

            self.expropiated_process = process
            self.execute_simulation(self.simulating_switch, None)

        print("^ expropiate:", process.__str__(True))
        self.process_manager.execute_process(process)

        self.expropiated_process = process
        self.execute_simulation(self.simulating_switch, None)

    # __________________________________________________________________________
    def complete_execution(self, _) -> bool:
        # Execute until complete, then deactivate
        executed_process = self.process_manager.executed_process
        if executed_process:
            executed_process.progress += executed_process.advance
            print("* execute:", executed_process.__str__(True))

            if executed_process.progress >= 1:
                self.deactivate_process_action()
                del self.expropiated_process
                self.expropiated_process = None
                self.execute_simulation(self.simulating_switch, None)

        self.update_components()
        return self.expropiated_process != None
コード例 #14
0
ファイル: inbound_worker.py プロジェクト: CMPE275/Project2
def start_thread():
    ProcessManager.__init__()
    w = threading.Thread(name='worker', target=worker)
    w.start()
コード例 #15
0
def run_server():
    ProcessManager.set_role("CUSTOMER")
    print 'make api call to get customer queue size'
    inbound_worker.start_thread()
    app.run()