def test_machine_info(): h = socket.gethostname() ms = MonitoringSession('ms-01') mi_list = ms.get_all_machines([h]) print(mi_list) assert (len(mi_list) == 1) mi = mi_list[0] assert (mi.name == h) print('\nGot machine info: %s' % (mi.to_dict()))
def test_queue_info(): q_name_list = os.popen('qconf -sql').read().split() print('\nGot queue list: %s' % q_name_list) ms = MonitoringSession('ms-01') qi_list = ms.get_all_queues(q_name_list) assert (len(qi_list) > 0) for qi in qi_list: q_name = qi.name print('\nChecking queue: %s' % (qi.to_dict())) assert (q_name in q_name_list)
def test_get_all_machines(): h_name_list = os.popen('qconf -sel').read().split() print('\nGot host list: %s' % h_name_list) ms = MonitoringSession('ms-01') mi_list = ms.get_all_machines(h_name_list) assert (len(mi_list) == len(h_name_list)) for mi in mi_list: h_name = mi.name print('Checking machine: %s' % (mi.to_dict())) assert (h_name in h_name_list)
def test_machine_info(): host_list = os.popen('qconf -sel').read().split() print('\nGot hosts: %s' % host_list) h = host_list[0] print('\nUsing first host: %s' % h) ms = MonitoringSession('ms-01') mi_list = ms.get_all_machines([h]) print(mi_list) assert (len(mi_list) == 1) mi = mi_list[0] assert (mi.name == h) print('\nGot machine info: %s' % (mi.to_dict()))
def test_get_all_reservatios(): rs = ReservationSession('rs-01') r_name = 'drmaa2python-%s' % int(random.uniform(0, 1000)) d = {'reservation_name': r_name, 'duration': 100} r = rs.request_reservation(d) print('\nCreated reservation: %s' % r) ri = r.get_info() # At the moment one cannot have both reservation and monitoring # sessions opened at the same time rs.close() ms = MonitoringSession('ms-01') print('Retrieving reservations matching reservation info %s' % ri) r_list = ms.get_all_reservations(ri) print('Got all reservations: %s' % r_list) assert (len(r_list) == 1)
def test_get_all_jobs(): js = JobSession('js-01') j_name = 'drmaa2python-%s' % int(random.uniform(0, 1000)) j = js.run_job({ 'remote_command': '/bin/sleep', 'args': ['10'], 'job_name': j_name }) print('\nSubmitted job: %s' % j) ji = j.get_info() j.wait_started() ms = MonitoringSession('ms-01') print('Opened monitoring session: %s' % ms.name) ji2 = JobInfo({'job_id': ji.job_id}) print('Retrieving jobs matching job info %s' % ji2) j_list = ms.get_all_jobs(ji2) print('Got all jobs: %s' % j_list) assert (len(j_list) >= 1)
#!/usr/bin/env python # ___INFO__MARK_BEGIN__ ########################################################################## # Copyright 2016-2019 Univa Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ########################################################################### # ___INFO__MARK_END__ import socket from drmaa2 import MonitoringSession if __name__ == '__main__': ms = MonitoringSession('ms-01') print('Opened monitoring session: %s' % ms.name) hostname = socket.gethostname() print('Retrieving machine information for host %s' % hostname) mi_list = ms.get_all_machines([hostname]) print('Got all machines: %s' % mi_list)
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ####################################################################################### # ___INFO__MARK_END__ import random from drmaa2 import ReservationInfo from drmaa2 import ReservationSession from drmaa2 import MonitoringSession if __name__ == '__main__': rs = ReservationSession('rs-01') print('Created reservation session: %s' % rs.name) r_name = 'res-%s' % int(random.uniform(0, 1000)) d = {'reservation_name': r_name, 'duration': 100} r = rs.request_reservation(d) print('Created reservation: %s' % r) # ri = r.get_info() ri = ReservationInfo({'reservation_name': r_name}) # At the moment one cannot have both reservation and monitoring # sessions opened at the same time rs.close() ms = MonitoringSession('ms-01') print('Opened monitoring session: %s' % ms.name) print('Retrieving reservations matching reservation info %s' % ri) r_list = ms.get_all_reservations(ri) print('Got all reservations: %s' % r_list)
#!/usr/bin/env python # ___INFO__MARK_BEGIN__ ########################################################################## # Copyright 2016-2019 Univa Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ########################################################################### # ___INFO__MARK_END__ from drmaa2 import MonitoringSession if __name__ == '__main__': ms = MonitoringSession('ms-01') print('Opened monitoring session: %s' % ms.name) q_name = 'all.q' print('Retrieving queue information for %s' % q_name) qi_list = ms.get_all_queues([q_name]) print('Got all queues: %s' % qi_list)
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ####################################################################################### # ___INFO__MARK_END__ import random from drmaa2 import JobSession from drmaa2 import JobInfo from drmaa2 import MonitoringSession if __name__ == '__main__': js = JobSession('js-01') print('Created job session: %s' % js.name) j_name = 'job-%s' % int(random.uniform(0, 1000)) j = js.run_job({ 'remote_command': '/bin/sleep', 'args': ['10'], 'job_name': j_name }) print('Submitted job: %s' % j) # ji = j.get_info() ji = JobInfo({'job_name': j_name}) ms = MonitoringSession('ms-01') print('Opened monitoring session: %s' % ms.name) print('Retrieving jobs matching job info %s' % ji) j_list = ms.get_all_jobs(ji) print('Got all jobs: %s' % j_list)