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

Logging supervisor's child process logs #588

Merged
merged 3 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- SUPERVISOR_URL=127.0.0.1:9001
- AUTOTESTER_CONFIG=/app/.dockerfiles/docker-config.yml
- STACK_ROOT=/home/docker/.autotesting/.stack
- SUPERVISOR_CHILD_LOG=/home/docker/.autotesting/supervisor_child_log
depends_on:
- postgres
- redis
Expand Down
1 change: 1 addition & 0 deletions server/autotest_server/settings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
workspace: !ENV ${WORKSPACE}
redis_url: !ENV ${REDIS_URL}
supervisor_url: !ENV ${SUPERVISOR_URL}
supervisor_child_log: !ENV ${SUPERVISOR_CHILD_LOG}
workers:
- user: !ENV ${USER}
queues:
Expand Down
6 changes: 6 additions & 0 deletions server/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def create_workspace():
os.makedirs(config["workspace"], exist_ok=True)


def create_supervisor_child_log():
_print(f'creating supervisor log folder for its children at {config["supervisor_child_log"]}')
os.makedirs(config["supervisor_child_log"], exist_ok=True)


def install_all_testers():
settings = install_testers()
skeleton_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "autotest_server", "schema_skeleton.json")
Expand All @@ -76,6 +81,7 @@ def install():
check_dependencies()
check_users_exist()
create_workspace()
create_supervisor_child_log()
install_all_testers()


Expand Down
12 changes: 12 additions & 0 deletions server/start_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
autorestart=true
stopasgroup=true
killasgroup=true
stdout_logfile={stdout_logfile}
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stderr_logfile={stderr_logfile}
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10

"""

Expand All @@ -57,6 +63,12 @@ def create_enqueuer_wrapper(rq):
queues=" ".join(worker_data["queues"]),
numprocs=1,
directory=os.path.dirname(os.path.realpath(__file__)),
stdout_logfile=os.path.join(
_THIS_DIR, f'{config["supervisor_child_log"]}/{worker_data["user"]}_stdout.log'
),
stderr_logfile=os.path.join(
_THIS_DIR, f'{config["supervisor_child_log"]}/{worker_data["user"]}_stderr.log'
),
)
f.write(c)

Expand Down