Example #1
0
    def __init__(self, username, password, scheduler):
        self.jobs = {}
        self.next_job_id = 0

        self.nodes = {}
        self.node_ids = {}

        self.auth_header = auth_header(username, password)

        # (Proportion of nodes, max wall_time (hours), list of nodes)
        self.node_queue = {
            'DEFAULT': (0.5, walltime.strptime("7:00:00:00"), []),
            'BATCH': (0.3, None, []),
            'FAST': (0.2, walltime.strptime("01:00:00"), [])
        }

        self.next_node_id = 0

        self.queue_lock = threading.Lock()
        self.queue = []

        # Remove all job related files
        path = os.path.join('www', 'jobs')
        if os.path.exists(path):
            shutil.rmtree(path)

        # Start the scheduler
        self.scheduler = scheduler
Example #2
0
	def __init__(self, username, password, scheduler):
		self.jobs = {}
		self.next_job_id = 0
		
		self.nodes = {}
		self.node_ids = {}

		self.auth_header = auth_header(username, password)

		# (Proportion of nodes, max wall_time (hours), list of nodes)
		self.node_queue = {
			'DEFAULT': (0.5, walltime.strptime("7:00:00:00"), []),
			'BATCH': (0.3, None, []),
			'FAST': (0.2, walltime.strptime("01:00:00"), []) 
		}

		self.next_node_id = 0

		self.queue_lock = threading.Lock()
		self.queue = []

		# Remove all job related files
		path = os.path.join('www', 'jobs')
		if os.path.exists(path):
			shutil.rmtree(path)

		# Start the scheduler
		self.scheduler = scheduler
Example #3
0
    def __init__(self, username, password, host, port, ghost, gport, cost,
                 cores, programs):

        self.username = username
        self.password = password

        self.host = host
        self.port = port
        self.ghost = ghost
        self.gport = gport

        self.tasks = {}
        self.next_task_id = 0
        self.retry_attempts = 0

        self.programs = programs
        self.cost = int(cost)

        self.auth_header = auth_header(self.username, self.password)

        if cores <= 0:
            try:
                self.cores = multiprocessing.cpu_count()
            except NotImplementedError:
                self.cores = 1
        else:
            self.cores = int(cores)

        # Register the node with The Grid
        try:
            self.node_id = self.register_node()
        except ServerUnavailableException as e:
            print "%s" % (e.args[0])
            sys.exit(1)

        # Start the Monitor
        self.mon = monitor.Monitor()

        # Start the Process Monitor and Heartbeat
        self.start_monitor()
        self.start_heartbeat()
Example #4
0
	def __init__(self, username, password, host, port, ghost, gport, cost, cores, programs):

		self.username = username
		self.password = password

		self.host = host
		self.port = port
		self.ghost = ghost
		self.gport = gport

		self.tasks = {}
		self.next_task_id = 0
		self.retry_attempts = 0

		self.programs = programs
		self.cost = int(cost)

		self.auth_header = auth_header(self.username, self.password)
	
		if cores <= 0:
			try:
				self.cores = multiprocessing.cpu_count()
			except NotImplementedError:
				self.cores = 1
		else:
			self.cores = int(cores)
		
		# Register the node with The Grid
		try:
			self.node_id = self.register_node()
		except ServerUnavailableException as e:
			print "%s" % (e.args[0])
			sys.exit(1)

		# Start the Monitor
		self.mon = monitor.Monitor()

		# Start the Process Monitor and Heartbeat
		self.start_monitor()
		self.start_heartbeat()
Example #5
0
parser.add_option("--jo", "--job_output", dest="job_id_output",
	help="The Job ID of a job to request the output of.",
	metavar="JOB_ID")

parser.add_option("--js", "--job_status", dest="job_id_status",
	help="The Job ID of a job to request the status of.",
	metavar="JOB_ID")

parser.add_option("--gs", "--grid_status", dest="grid_status",
	action="store_true", default = False,
	help="Request the status of The Grid",
	metavar="GRID_STATUS")

(options, args) = parser.parse_args()

auth_header = auth_header(options.username, options.password)

grid_url = "http://%s:%s" % (options.ghost, options.gport)

#
# Change Scheduler
#

if options.scheduler:
	
	try:
		url = '%s/scheduler' % (grid_url)
		request = JSONHTTPRequest( 'PUT', url, { 'scheduler': options.scheduler }, auth_header )

	except (HTTPError, URLError) as e:
		client_utils.request_error(e, "Could not update the scheduler of The Grid.")