Start notebook if not yet running with these settings.

        Return the updated settings with a port info.

        :return: (context dict, created flag)
555993
def start_notebook_on_demand(self, name, context):
        
        if self.is_running(name):

            last_context = self.get_context(name)
            logger.info("Notebook context change detected for %s", name)
            if not self.is_same_context(context, last_context):
                self.stop_notebook(name)
                # Make sure we don't get race condition over context.json file
                time.sleep(2.0)
            else:
                return last_context, False

        err_log = os.path.join(self.get_work_folder(name), "notebook.stderr.log")
        logger.info("Launching new Notebook named %s, context is %s", name, context)
        logger.info("Notebook log is %s", err_log)

        self.start_notebook(name, context)
        time.sleep(1)
        context = self.get_context(name)
        if "notebook_name" not in context:
            # Failed to launch within timeout
            raise RuntimeError("Failed to launch IPython Notebook, see {}".format(err_log))

        return context, True
738452
async def restart(self):
        '''
        
        '''
        params = {}
        if self.owner_access_key:
            params['owner_access_key'] = self.owner_access_key
        rqst = Request(self.session,
                       'PATCH', '/kernel/{}'.format(self.kernel_id),
                       params=params)
        async with rqst.fetch():
            pass
705483
def run(self):
        
        LOGGER.info('%s v%s started', self.APPNAME, self.VERSION)
        self.setup()
        while not any([self.is_stopping, self.is_stopped]):
            self.set_state(self.STATE_SLEEPING)
            try:
                signum = self.pending_signals.get(True, self.wake_interval)
            except queue.Empty:
                pass
            else:
                self.process_signal(signum)
                if any([self.is_stopping, self.is_stopped]):
                    break
            self.set_state(self.STATE_ACTIVE)
            self.process()
249955
def spawn_managed_host(config_file, manager, connect_on_start=True):
    

    data = manager.request_host_status(config_file)

    is_running = data['started']

    # Managed hosts run as persistent processes, so it may already be running
    if is_running:
        host_status = json.loads(data['host']['output'])
        logfile = data['host']['logfile']
    else:
        data = manager.start_host(config_file)
        host_status = json.loads(data['output'])
        logfile = data['logfile']

    host = JSHost(
        status=host_status,
        logfile=logfile,
        config_file=config_file,
        manager=manager
    )

    if not is_running and settings.VERBOSITY >= verbosity.PROCESS_START:
        print('Started {}'.format(host.get_name()))

    if connect_on_start:
        host.connect()

    return host
154313
def run(self):
        
        # Bind the socket to the port
        logging.info("Server starts socket on {addr}".format(addr=self.server_address))

        # Create a UDS socket
        if six.PY2:
            sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            self.listen(sock)
            sock.close()
        else:
            with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
                self.listen(sock)
        try:
            os.unlink(self.server_address)
        except OSError:
            if os.path.exists(self.server_address):
                raise
        return
463213
def start(self):
        
        if not global_sdk_config.sdk_enabled():
            return

        with self._lock:
            if not self._started:
                self._rule_poller.start()
                self._target_poller.start()
                self._started = True
39510
def start(self):
        ''''''
        self.update_device_info()
        self.get_device_status(0) # start addons.
        self.hook()
        self.thread = threading.Thread(target=self._run)
        self.thread.start()
        self.running = True
27110
def start_connect(self):
        
        if self._start_connect is not None:
            raise TimeoutStateError("Timeout timer has already been started.")
        self._start_connect = current_time()
        return self._start_connect
967701
def run(self):
        

        if not self.args:
            self.parse_args()

        if self.args.log_level:
            logging.getLogger().setLevel(logging.getLevelName(self.args.log_level))
            logging.debug('Enabled {} logging level'.format(self.args.log_level))

        if self.args.import_ipynb:
            check_isfile(self.args.import_ipynb)
            logging.info('Loading Jupyter notebook {}'.format(self.args.import_ipynb))
            self.nb = nbf.read(self.args.import_ipynb, as_version=4)
            uid = self.args.import_ipynb
        else:
            uid = self.load_cells_params()

        logging.debug("Unique id: '{}'".format(uid))
        logging.info('Disable cache: {}'.format(self.args.disable_cache))
        logging.info('Ignore cache: {}'.format(self.args.ignore_cache))

        if self.args.export_pynb and not self.args.no_exec:
            fatal('--export-pynb requires --no-exec')

        if self.args.kernel:
            self.set_kernel(self.args.kernel)

        self.process(uid=uid,
                     add_footer=not self.args.disable_footer,
                     no_exec=self.args.no_exec,
                     disable_cache=self.args.disable_cache,
                     ignore_cache=self.args.ignore_cache)

        if self.args.export_html:
            self.export_html(self.args.export_html)

        if self.args.export_ipynb:
            self.export_ipynb(self.args.export_ipynb)

        if self.args.export_pynb:
            self.export_pynb(self.args.export_pynb)
348019
def restart(ctx, job_name, data, open_notebook, env, message, gpu, cpu, gpup, cpup, command):
    
    # Error early if more than one --env is passed. Then get the first/only
    # --env out of the list so all other operations work normally (they don't
    # expect an iterable). For details on this approach, see the comment above
    # the --env click option
    if len(env) > 1:
        floyd_logger.error(
            "You passed more than one environment: {}. Please specify a single environment.".format(env)
        )
        sys.exit(1)
    env = env[0]

    parameters = {}

    expt_client = ExperimentClient()

    try:
        job = expt_client.get(normalize_job_name(job_name))
    except FloydException:
        job = expt_client.get(job_name)

    if gpu:
        instance_type = G1_INSTANCE_TYPE
    elif cpu:
        instance_type = C1_INSTANCE_TYPE
    else:
        instance_type = job.instance_type

    if instance_type is not None:
        parameters['instance_type'] = instance_type
    else:
        instance_type = job.instance_type

    if env is not None:
        arch = INSTANCE_ARCH_MAP[instance_type]
        if not validate_env(env, arch):
            sys.exit(1)
        parameters['env'] = env

    success, data_ids, show_data_info = process_data_ids(data)
    if not success:
        sys.exit(1)
    if data_ids:
        parameters['data_ids'] = data_ids

    if message:
        parameters['description'] = message

    if command:
        parameters['command'] = ' '.join(command)

    floyd_logger.info('Restarting job %s...', job_name)

    new_job_info = expt_client.restart(job.id, parameters=parameters)
    if not new_job_info:
        floyd_logger.error("Failed to restart job")
        sys.exit(1)

    show_new_job_info(expt_client, new_job_info['name'], new_job_info, job.mode, open_notebook, show_data_info)
1311198
def start():
    '''
    
    '''
    mod_opts = __opts__.get(__virtualname__, {})

    if 'num_processes' not in mod_opts:
        mod_opts['num_processes'] = 1

    if mod_opts['num_processes'] > 1 and mod_opts.get('debug', False) is True:
        raise Exception((
            'Tornado\'s debug implementation is not compatible with multiprocess. '
            'Either disable debug, or set num_processes to 1.'
        ))

    # the kwargs for the HTTPServer
    kwargs = {}
    if not mod_opts.get('disable_ssl', False):
        if 'ssl_crt' not in mod_opts:
            log.error("Not starting '%s'. Options 'ssl_crt' and "
                    "'ssl_key' are required if SSL is not disabled.",
                    __name__)

            return None
        # cert is required, key may be optional
        # https://docs.python.org/2/library/ssl.html#ssl.wrap_socket
        ssl_opts = {'certfile': mod_opts['ssl_crt']}
        if mod_opts.get('ssl_key', False):
            ssl_opts.update({'keyfile': mod_opts['ssl_key']})
        kwargs['ssl_options'] = ssl_opts

    import tornado.httpserver
    http_server = tornado.httpserver.HTTPServer(get_application(__opts__), **kwargs)
    try:
        http_server.bind(mod_opts['port'],
                         address=mod_opts.get('address'),
                         backlog=mod_opts.get('backlog', 128),
                         )
        http_server.start(mod_opts['num_processes'])
    except Exception:
        log.error('Rest_tornado unable to bind to port %s', mod_opts['port'], exc_info=True)
        raise SystemExit(1)

    try:
        tornado.ioloop.IOLoop.current().start()
    except KeyboardInterrupt:
        raise SystemExit(0)
328893
def start_to(self, ip, tcpport=102):
        
        if tcpport != 102:
            logger.info("setting server TCP port to %s" % tcpport)
            self.set_param(snap7.snap7types.LocalPort, tcpport)
        assert re.match(ipv4, ip), '%s is invalid ipv4' % ip
        logger.info("starting server to %s:102" % ip)
        return self.library.Srv_Start(self.pointer, ip)
932302
def port(self):
        
        return self._val.port or DEFAULT_PORTS.get(self._val.scheme)
499127
def _session_start(self):
        
        return self._session_class(self._session_id,
                                   self._session_duration,
                                   self._session_settings)
246708
def start(self) -> None:
        
        if self.running:
            return
        self.info("Starting: {} (with logs stdout={}, stderr={})".format(
            self.details.procargs,
            self.details.logfile_out,
            self.details.logfile_err))
        self.open_logs()
        creationflags = CREATE_NEW_PROCESS_GROUP if WINDOWS else 0
        # self.warning("creationflags: {}".format(creationflags))
        self.process = subprocess.Popen(self.details.procargs, stdin=None,
                                        stdout=self.stdout, stderr=self.stderr,
                                        creationflags=creationflags)
        self.running = True
1049309
def start(self):
        

        if threading.current_thread().name == 'MainThread':
            signal.signal(signal.SIGINT, self.stop)

        logging.info('Started on {}'.format(self.address))

        while True:
            self.process()
86511
def start(self, **kwargs):
        
        return self.client.api.start(self.id, **kwargs)