Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add config for job_loggers #18970

Merged
merged 3 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ trivy:
jobservice:
# Maximum number of job workers in job service
max_job_workers: 10
# The jobLoggers backend name, only support "STD_OUTPUT", "FILE" and/or "DB"
job_loggers:
- STD_OUTPUT
- FILE
# - DB
# The jobLogger sweeper duration (ignored if `jobLogger` is `stdout`)
logger_sweeper_duration: 1 #days

Expand Down
15 changes: 14 additions & 1 deletion make/photon/prepare/templates/jobservice/config.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ worker_pool:
idle_timeout_second: 3600
#Loggers for the running job
job_loggers:
- name: "STD_OUTPUT" # logger backend name, only support "FILE" and "STD_OUTPUT"
# The jobLoggers backend name, only support "STD_OUTPUT", "FILE" and/or "DB"
{% for component in job_loggers %}
{% if component == 'STD_OUTPUT' %}
- name: "STD_OUTPUT"
level: "{{level}}" # INFO/DEBUG/WARNING/ERROR/FATAL
{% endif %}
{% if component == 'FILE' %}
- name: "FILE"
level: "{{level}}"
settings: # Customized settings of logger
Expand All @@ -39,6 +44,14 @@ job_loggers:
duration: {{logger_sweeper_duration}} #days
settings: # Customized settings of sweeper
work_dir: "/var/log/jobs"
{% endif %}
{% if component == 'DB' %}
- name: "DB"
level: "{{level}}"
sweeper:
duration: {{logger_sweeper_duration}} #days
{% endif %}
{% endfor %}

#Loggers for the job service
loggers:
Expand Down
1 change: 1 addition & 0 deletions make/photon/prepare/utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def parse_yaml_config(config_file_path, with_trivy):
# jobservice config
js_config = configs.get('jobservice') or {}
config_dict['max_job_workers'] = js_config["max_job_workers"]
config_dict['job_loggers'] = js_config["job_loggers"]
config_dict['logger_sweeper_duration'] = js_config["logger_sweeper_duration"]
config_dict['jobservice_secret'] = generate_random_string(16)

Expand Down
1 change: 1 addition & 0 deletions make/photon/prepare/utils/jobservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def prepare_job_service(config_dict):
gid=DEFAULT_GID,
internal_tls=config_dict['internal_tls'],
max_job_workers=config_dict['max_job_workers'],
job_loggers=config_dict['job_loggers'],
logger_sweeper_duration=config_dict['logger_sweeper_duration'],
redis_url=config_dict['redis_url_js'],
level=log_level,
Expand Down