-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
12 changed files
with
590 additions
and
8 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
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,3 +1,18 @@ | ||
from .api import run | ||
import logging | ||
import sys | ||
from .api import run, config | ||
from .joblogs import joblogs_init | ||
|
||
run() | ||
def setup_logging(): | ||
logging.basicConfig( | ||
level=logging.INFO, | ||
format='%(asctime)s %(name)s [%(levelname)s]: %(message)s', | ||
handlers=[ | ||
logging.StreamHandler(sys.stdout) | ||
] | ||
) | ||
|
||
if __name__ == "__main__": | ||
setup_logging() | ||
joblogs_init(config) | ||
run() |
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
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,25 @@ | ||
import logging | ||
from scrapyd_k8s.joblogs.log_handler_k8s import KubernetesJobLogHandler | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
def joblogs_init(config): | ||
""" | ||
Initializes job logs handling by starting the Kubernetes job log handler. | ||
Parameters | ||
---------- | ||
config : Config | ||
Configuration object containing settings for job logs and storage. | ||
Returns | ||
------- | ||
None | ||
""" | ||
joblogs_config = config.joblogs() | ||
if joblogs_config and joblogs_config.get('storage_provider') is not None: | ||
log_handler = KubernetesJobLogHandler(config) | ||
log_handler.start() | ||
logger.info("Job logs handler started.") | ||
else: | ||
logger.warning("No storage provider configured; job logs will not be uploaded.") |
Oops, something went wrong.