Example #1
0
def test_new_menu_method():
    errors = ProcessErrors()
    output = SendOptions(['Exit'])

    start_process(__name__, 'create_test_menu', output, errors)

    assert errors.hasError is False, 'Errors were raised when running test'
Example #2
0
def test_sub_menus():
    errors = ProcessErrors()
    output = SendOptions(['Level One Menu', 'Exit'])

    start_process(__name__, 'create_test_menu', output, errors)

    assert errors.hasError is False, 'Errors were raised when running test with error: {}'.format(
        errors.error)
Example #3
0
def test_level_two_menu_item():
    errors = ProcessErrors()
    output = SendOptions(
        ['Level One Menu', 'Level Two Menu', 'LevelThreeMenuItemOne', 'Exit'],
        True)

    start_process(__name__, 'create_test_menu', output, errors)

    assert errors.hasError is False, 'Errors were raised when running test with error: {}'.format(
        errors.error)

    assert 'Called subsubmenu action' in output, 'Expected Menu Item was not called for menu item LevelThreeMenuItemOne'
Example #4
0
def test_action_throws_exception():
    """
    This test will test that if a Action throws an exception that that exception will not be propagated out of
    the topmenu show call.
    """
    errors = ProcessErrors()
    output = SendOptions(['Throws Exception'], keep=True)

    start_process(__name__, 'create_exception_test_menu', output, errors)

    assert errors.hasError is False, 'The Action exception was incorrectly propagated out of the menu call: {}'.format(
        errors.error)

    assert 'Action is throwing an exception' in output, 'The Action command did not throw an exception'
Example #5
0
 def start(self):
     import asyncore
     if self._source and not self.sensor:
         self.sensor = start_process(self.init_sensor)
     TCPServer(self.address, self.cache_path, self.maxsize, self.listen_num,
               self.archive_size)
     asyncore.loop()
Example #6
0
    def start_component(self, role, uuid, address):

        if role == "manager":
            command = "gym-{role} --uuid {uuid} --address {address} --contacts agent/127.0.0.1:50053 monitor/127.0.0.1:50054  &"
        else:
            command = "gym-{role} --uuid {uuid} --address {address} &"

        cmd_formatted = command.format(role=role, uuid=uuid, address=address)
        cmd_args = cmd_formatted.split(" ")
        p = start_process(cmd_args)
        return p
Example #7
0
def minion(request, minion_config, wheel_client, env, context):
    context['MINION_KEY'] = env['HOSTNAME']
    request.addfinalizer(
        partial(delete_minion_key, wheel_client, context['MINION_KEY'], env))
    return start_process(request, SALT_MINION_START_CMD, env)
Example #8
0
def proxyminion(request, proxyminion_config, wait_proxy_server_ready,
                wheel_client, env, context):
    context['MINION_KEY'] = env['PROXY_ID']
    request.addfinalizer(
        partial(delete_minion_key, wheel_client, context['MINION_KEY'], env))
    return start_process(request, SALT_PROXYMINION_START_CMD, env)
Example #9
0
 def ip_netns_exec(namespace, command, **kwargs):
     ip_netns_cmd = f"ip netns exec {namespace} {command}"
     return utils.start_process(ip_netns_cmd, echo=True, **kwargs)
Example #10
0
def proxy_server(request, env):
    return start_process(request, START_PROXY_SERVER, env)
Example #11
0
def minion(request, minion_config, wheel_client, env, context):
    context['MINION_KEY'] = env['HOSTNAME']
    request.addfinalizer(
        partial(delete_minion_key, wheel_client, context['MINION_KEY'], env)
    )
    return start_process(request, SALT_MINION_START_CMD, env)
Example #12
0
def master(request, master_config, env):
    return start_process(request, SALT_MASTER_START_CMD, env)
Example #13
0
import utils
import global_config

if __name__ == '__main__':
    """ Start all the aal-pip processes"""

    processes = [
        "cpu_load_wd.py", "file_svr.py", "super.py", "svr_proxy.py",
        "modem_svr.py", "hf_mgr.py", "sc_mgr.py", "fg_mgr.py", "cases_mgr.py",
        "usb_mgr.py", "gps_mgr", "hw_mgr.py"
    ]

    print('AAL-PIP software version %s' % global_config.sw_version_number)
    for process in reversed(processes):
        if utils.process_is_running(process):
            print '%s is already running' % process
            continue
        print 'Starting %s' % process
        utils.start_process(process)
        utils.wait(2.0)
    for i in range(3):
        if utils.path_exists('/dev/sda1'):
            if not utils.path_exists('/mnt/usbflash'):
                utils.call_subprocess('mkdir -p /mnt/usbflash')
            utils.call_subprocess('mount /dev/sda1 /mnt/usbflash')
            if not utils.path_exists('/mnt/usbflash/data'):
                utils.call_subprocess('mkdir -p /mnt/usbflash/data')
            break
        utils.wait(2)
Example #14
0
 def start_component(self, uuid, address):
     command = "sudo umbra-scenario --uuid {uuid} --address {address} --debug &"
     cmd_formatted = command.format(uuid=uuid, address=address)
     cmd_args = cmd_formatted.split(" ")
     p = start_process(cmd_args)
     return p
Example #15
0
## TEMPORARY ## SHOULD BE DELETED AFTER KELDER.ZEUS HAS THEIR CERTIFICATE
from flask.ext.migrate import MigrateCommand, Migrate
from flask.ext.script import Manager
import os
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

from app import app, db

from admin import admin
from login import login_manager
from models import *
from utils import start_process
from views import *


if __name__ == '__main__':
    start_process()

    # do it here, because make accessing db changes only possible when executing the program directly
    migrate = Migrate(app, db)
    manager = Manager(app)
    manager.add_command('db', MigrateCommand)
    manager.run()
Example #16
0
 def start_component(self, role, uuid, address):
     command = "gym-{role} --uuid {uuid} --address {address} --debug &"
     cmd_formatted = command.format(role=role, uuid=uuid, address=address)
     cmd_args = cmd_formatted.split(" ")
     p = start_process(cmd_args)
     return p
Example #17
0
def proxyminion(request, proxyminion_config, wait_proxy_server_ready, wheel_client, env, context):
    context['MINION_KEY'] = env['PROXY_ID']
    request.addfinalizer(
        partial(delete_minion_key, wheel_client, context['MINION_KEY'], env)
    )
    return start_process(request, SALT_PROXYMINION_START_CMD, env)
Example #18
0
def proxy_server(request, env):
    return start_process(request, START_PROXY_SERVER, env)
Example #19
0
            })
    if not (params.CKPT_PATH / params.CKPT_FILE).exists() or not (
            params.LOGGING_PATH / params.RT_META_FILE).exists():
        params.RESTART = True

    print('        model: %s' % M.name())
    print('cover dataset: %s' % covr_ds.get_name())
    print(' hide dataset: %s' % hide_ds.get_name())
    print('   batch size: %s' % params.BATCH_SIZE)
    print('batches/epoch: %s' % batches)
    print('    max epoch: %s' % params.TRAIN_MAX_EPOCH)
    print('      restart: %s' % str(params.RESTART))

    # Dataset
    utils.start_process('train/covr',
                        gns.dataset_generator,
                        args=(queue, covr_ds, 'train', 'covr',
                              params.BATCH_SIZE))
    utils.start_process('train/hide',
                        gns.dataset_generator,
                        args=(queue, hide_ds, 'train', 'hide',
                              params.BATCH_SIZE))
    utils.start_process('valid/covr',
                        gns.dataset_generator,
                        args=(queue, covr_ds, 'valid', 'covr',
                              params.BATCH_SIZE))
    utils.start_process('valid/hide',
                        gns.dataset_generator,
                        args=(queue, hide_ds, 'valid', 'hide',
                              params.BATCH_SIZE))

    # Main Process Pipeline
Example #20
0
 def start(self):
     if hasattr(self.exe, 'start'):
         return start_process(self.exe.start)
     else:
         return start_process(self._run)
Example #21
0
 def start_agent(self, uuid, address):
     command = "gym-agent --uuid {uuid} --address {address} --debug &"
     cmd_formatted = command.format(uuid=uuid, address=address)
     cmd_args = cmd_formatted.split(" ")
     p = start_process(cmd_args)
     return p
Example #22
0
 def start_monitor(self, uuid, address):
     command = "umbra-monitor --uuid {uuid} --address {address} --debug &"
     cmd_formatted = command.format(uuid=uuid, address=address)
     cmd_args = cmd_formatted.split(" ")
     p = start_process(cmd_args)
     return p
Example #23
0
def master(request, master_config, env):
    return start_process(request, SALT_MASTER_START_CMD, env)