-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1549d9
commit 112282d
Showing
4 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,45 @@ | ||
import argparse | ||
import logging | ||
|
||
import uvicorn | ||
|
||
from nebari_workflow_controller import DEFAULT_LOGGING_CONFIG as LOGGING_CONFIG | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
logger.info("Starting nebari_workflow_controller") | ||
uvicorn.run( | ||
"nebari_workflow_controller.app:app", | ||
host="0.0.0.0", | ||
port=8080, | ||
reload=False, | ||
log_level=args.log_level.lower(), | ||
) | ||
|
||
|
||
def parse_args(): | ||
"""Parse command line arguments.""" | ||
parser = argparse.ArgumentParser(description="Process some integers.") | ||
parser.add_argument( | ||
"-l", | ||
"--log-level", | ||
dest="log_level", | ||
default="INFO", | ||
help="Set the log level (default: INFO)", | ||
) | ||
args = parser.parse_args() | ||
|
||
# Configure logging | ||
LOGGING_CONFIG["loggers"][""]["level"] = args.log_level | ||
LOGGING_CONFIG["loggers"]["nebari_workflow_controller"]["level"] = args.log_level | ||
logging.config.dictConfig(LOGGING_CONFIG) | ||
|
||
return args | ||
|
||
|
||
if __name__ == "__main__": | ||
# If you change these lines, then update nwc.py accordingly | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""This module provides an alias (nwc) for nebari-workflow-controller. | ||
E.g. "python -m nwc" or "python -m nebari_workflow_controller" will start nebari-workflow-controller. | ||
""" | ||
from nebari_workflow_controller.__main__ import main | ||
|
||
if __name__ == "__main__": | ||
main() |