I made a a small Monitoring Programm with 2 Subclasses of Threading.
Both running good but when i start my main.py just one thread is executed and the second one is not.
def main():
#Get SSH connection
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(docker_host, username=username, password=password)
# Threading Event
stop_event = threading.Event()
# Creating Threading Objects
monitoring = Monitor(ssh_client, stop_event, container1, container2)
query = Query_Servers(stop_event, url1, url2)
# Start both threads
print("Start monitoring")
monitoring.start()
print("start query")
query.start()
time.sleep(40)
monitoring.join()
query.join()
#Init Funktion
if __name__ == "__main__":
main()
What did i miss? The monitoring and query objects are subclasses of Threading. If i comment one of them out other one is running but they don’t run simultaneously.
Can you help me with this ?
New contributor
schuse is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.