Esempio n. 1
0
    def __init__(self, name, options, command, role=None):
        self.framework_id = None
        self.executor = None
        self.framework = Dict()
        self.framework.user = getuser()
        if self.framework.user == 'root':
            raise Exception('drun is not allowed to run as \'root\'')

        self.framework.name = name
        self.framework.hostname = socket.gethostname()
        if role is not None:
            self.framework.role = role
        self.cpus = options.cpus
        self.gpus = options.gpus
        self.mem = memory_str_to_mb(options.mem)
        self.options = options
        self.command = command
        self.started = False
        self.stopped = False
        self.status = 0
        self.next_try = 0
        self.lock = threading.RLock()
        self.last_offer_time = time.time()
        self.task_launched = {}
        self.agentTasks = {}

        # threads
        self.stdout_t = None
        self.stderr_t = None
Esempio n. 2
0
def parse_options():
    options, args = parser.parse_args()
    if options.mem is None:
        options.mem = conf.MEM_PER_TASK
    else:
        options.mem = memory_str_to_mb(options.mem)

    options.logLevel = (options.quiet and logging.ERROR
                        or options.verbose and logging.DEBUG or logging.INFO)
    if options.color is None:
        options.color = getattr(sys.stderr, 'isatty', lambda: False)()

    init_dpark_logger(options.logLevel, use_color=options.color)

    if any(arg.startswith('-') for arg in args):
        logger.warning('unknown args found in command-line: %s', ' '.join(args))

    return options
Esempio n. 3
0
def parse_options():
    options, args = parser.parse_args()
    if options.mem is None:
        options.mem = conf.MEM_PER_TASK
    else:
        options.mem = memory_str_to_mb(options.mem)

    options.logLevel = (options.quiet and logging.ERROR
                        or options.verbose and logging.DEBUG or logging.INFO)
    if options.color is None:
        options.color = getattr(sys.stderr, 'isatty', lambda: False)()

    init_dpark_logger(options.logLevel, use_color=options.color)

    if any(arg.startswith('-') for arg in args):
        logger.warning('unknown args found in command-line: %s', ' '.join(args))

    return options
Esempio n. 4
0
    def __init__(self, name, options, command, role=None):
        self.framework_id = None
        self.executor = None
        self.framework = Dict()
        self.framework.user = getuser()
        if self.framework.user == 'root':
            raise Exception('drun is not allowed to run as \'root\'')

        self.framework.name = name
        self.framework.hostname = socket.gethostname()
        if role is not None:
            self.framework.role = role
        self.cpus = options.cpus
        self.gpus = options.gpus
        self.mem = memory_str_to_mb(options.mem)
        self.options = options
        self.command = command
        self.started = False
        self.stopped = False
        self.ec = EXIT_UNEXPECTED
        self.next_try = 0
        self.lock = threading.RLock()
        self.last_offer_time = time.time()
        self.task_launched = {}
        self.agentTasks = {}

        # threads
        self.stdout_t = None
        self.stderr_t = None

        self.loghub_dir = None
        self.stats = {
            'ec': EXIT_UNEXPECTED,
            'init_time': time.time(),
            'submit_times': {},  # bind offers
            'start_time': None,  # mrun only: get all resources
            'slots': {},  # empty for drun
            'finish_times': {},
            'stop_time': None,
            'num_task': options.tasks,
            'mem_mb': self.mem,
            'scheduler': self.short_name,
            'cmd': os.path.abspath(sys.argv[0]) + ' ' + ' '.join(sys.argv[1:])
        }
Esempio n. 5
0
    def __init__(self, name, options, command, role=None):
        self.framework_id = None
        self.executor = None
        self.framework = Dict()
        self.framework.user = getuser()
        if self.framework.user == 'root':
            raise Exception('drun is not allowed to run as \'root\'')

        self.framework.name = name
        self.framework.hostname = socket.gethostname()
        if role is not None:
            self.framework.role = role
        self.cpus = options.cpus
        self.gpus = options.gpus
        self.mem = memory_str_to_mb(options.mem)
        self.options = options
        self.command = command
        self.started = False
        self.stopped = False
        self.ec = EXIT_UNEXPECTED
        self.next_try = 0
        self.lock = threading.RLock()
        self.last_offer_time = time.time()
        self.task_launched = {}
        self.agentTasks = {}

        # threads
        self.stdout_t = None
        self.stderr_t = None

        self.loghub_dir = None
        self.stats = {'ec': EXIT_UNEXPECTED,
                      'init_time': time.time(),
                      'submit_times': {},  # bind offers
                      'start_time': None,  # mrun only: get all resources
                      'slots': {},  # empty for drun
                      'finish_times': {},
                      'stop_time': None,
                      'num_task': options.tasks,
                      'mem_mb': self.mem,
                      'scheduler': self.short_name,
                      'cmd': os.path.abspath(sys.argv[0]) + ' ' + ' '.join(sys.argv[1:])
                      }