Skip to content
Snippets Groups Projects
Commit 1fd19ccf authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

add initial slurm agent code

parent d88aa16a
No related branches found
No related tags found
3 merge requests!23Feat resolve uid gid,!3Adding following agents,!4Test infra 1
#!/usr/bin/env python
import pika # python client
import sys
import rabbit_config as rcfg
import socket
import time
hostname = socket.gethostname().split(".", 1)[0]
connect_host = rcfg.Server if hostname != rcfg.Server else "localhost"
queue_name = "slurm_add_account"
duration = 2
# Set up credentials to connect to RabbitMQ server
credentials = pika.PlainCredentials(rcfg.User, rcfg.Password)
parameters = pika.ConnectionParameters(connect_host,
rcfg.Port,
rcfg.VHost,
credentials)
# Establish connection to RabbitMQ server
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
# create exchange to pass messages
channel.exchange_declare(exchange=rcfg.Exchange, exchange_type='direct')
# creates a random name for the newly generated queue
result = channel.queue_declare(queue=queue_name, exclusive=False)
channel.queue_bind(exchange=rcfg.Exchange, queue=queue_name, routing_key=queue_name)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment