Untitled conversation
- User
[Unit]
Human readable name of the unit
Description=Systemd Service for Inferencing Cron Job After=network.target
[Service]
Command to execute when the service is started
ExecStart=/bin/bash -c 'source /home/ubuntu/uhmldeploymentvenv/bin/activate && python3 /home/ubuntu/uh-ml-deployment-test/yolov8/cleansing_job_executor.py'
Disable Python's buffering of STDOUT and STDERR, so that output from the
service shows up immediately in systemd's logs
Environment=PYTHONUNBUFFERED=1 StandardOutput=journal StandardError=journal
Automatically restart the service if it crashes
Restart=on-failure
#systemd considers the service to be "started" as soon as the process in the ExecStart directive begins Type=simple
Use a dedicated user to run our service
User=root
[Install]
Tell systemd to automatically start this service when the system boots
(assuming the service is enabled)
WantedBy=default.target In this code , i want to read the working directory , virtual env and script path from a constant variable
- Assistant
To read the working directory, virtual environment, and script path from constant variables in your systemd service file, you can leverage environment variables or systemd's directive. Here’s how you can modify your service file to achieve this:
- User
Feb 03 10:20:21 ip-10-0-1-144 bash[3840]: File "/home/ubuntu/uh-ml-deployment-test/yolov8/utils/aws/secret_manager.py", line 10, in get_secret Feb 03 10:20:21 ip-10-0-1-144 bash[3840]: secret_name = config['general_settings']['secret_name'] Feb 03 10:20:21 ip-10-0-1-144 bash[3840]: TypeError: 'NoneType' object is not subscriptable
- Assistant
- User
why the i am getting this below error when i changed the password of aws account and my systemd service is not working as expected Feb 03 11:09:44 ip-10-0-1-144 bash[7417]: File "/home/ubuntu/uh-ml-deployment-test/yolov8/utils/aws/secret_manager.py", line 10, in get_secret Feb 03 11:09:44 ip-10-0-1-144 bash[7417]: secret_name = config['general_settings']['secret_name'] Feb 03 11:09:44 ip-10-0-1-144 bash[7417]: TypeError: 'NoneType' object is not subscriptable
- Assistant
- User
will it affect systemd service
- Assistant
- User
Issue in this line ExecStart=/bin/bash -c 'source /home/ubuntu/uh-cleansing/uhcleansingvir/bin/activate && exec nohup python3 /home/ubuntu/uh-cleansing/yolov8/cleansing_job_executor.py'
- Assistant