MCPcopy Create free account
hub / github.com/datapane/datapane / run

Function run

python-client/src/datapane/_vendor/bottle.py:3625–3735  ·  view source on GitHub ↗

Start a server instance. This method blocks until the server terminates. :param app: WSGI application or target string supported by :func:`load_app`. (default: :func:`default_app`) :param server: Server adapter to use. See :data:`server_names` keys for

(app=None,
        server='wsgiref',
        host='127.0.0.1',
        port=8080,
        interval=1,
        reloader=False,
        quiet=False,
        plugins=None,
        debug=None,
        config=None, **kargs)

Source from the content-addressed store, hash-verified

3623
3624
3625def run(app=None,
3626 server='wsgiref',
3627 host='127.0.0.1',
3628 port=8080,
3629 interval=1,
3630 reloader=False,
3631 quiet=False,
3632 plugins=None,
3633 debug=None,
3634 config=None, **kargs):
3635 """ Start a server instance. This method blocks until the server terminates.
3636
3637 :param app: WSGI application or target string supported by
3638 :func:`load_app`. (default: :func:`default_app`)
3639 :param server: Server adapter to use. See :data:`server_names` keys
3640 for valid names or pass a :class:`ServerAdapter` subclass.
3641 (default: `wsgiref`)
3642 :param host: Server address to bind to. Pass ``0.0.0.0`` to listens on
3643 all interfaces including the external one. (default: 127.0.0.1)
3644 :param port: Server port to bind to. Values below 1024 require root
3645 privileges. (default: 8080)
3646 :param reloader: Start auto-reloading server? (default: False)
3647 :param interval: Auto-reloader interval in seconds (default: 1)
3648 :param quiet: Suppress output to stdout and stderr? (default: False)
3649 :param options: Options passed to the server adapter.
3650 """
3651 if NORUN: return
3652 if reloader and not os.environ.get('BOTTLE_CHILD'):
3653 import subprocess
3654 fd, lockfile = tempfile.mkstemp(prefix='bottle.', suffix='.lock')
3655 environ = os.environ.copy()
3656 environ['BOTTLE_CHILD'] = 'true'
3657 environ['BOTTLE_LOCKFILE'] = lockfile
3658 args = [sys.executable] + sys.argv
3659 # If a package was loaded with `python -m`, then `sys.argv` needs to be
3660 # restored to the original value, or imports might break. See #1336
3661 if getattr(sys.modules.get('__main__'), '__package__', None):
3662 args[1:1] = ["-m", sys.modules['__main__'].__package__]
3663
3664 try:
3665 os.close(fd) # We never write to this file
3666 while os.path.exists(lockfile):
3667 p = subprocess.Popen(args, env=environ)
3668 while p.poll() is None:
3669 os.utime(lockfile, None) # Tell child we are still alive
3670 time.sleep(interval)
3671 if p.returncode == 3: # Child wants to be restarted
3672 continue
3673 sys.exit(p.returncode)
3674 except KeyboardInterrupt:
3675 pass
3676 finally:
3677 if os.path.exists(lockfile):
3678 os.unlink(lockfile)
3679 return
3680
3681 try:
3682 if debug is not None: _debug(debug)

Callers 3

runMethod · 0.85
runMethod · 0.85
_mainFunction · 0.85

Calls 10

load_appFunction · 0.85
_stderrFunction · 0.85
FileCheckerThreadClass · 0.85
installMethod · 0.80
updateMethod · 0.80
loadFunction · 0.70
getMethod · 0.45
copyMethod · 0.45
closeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected