コード例 #1
0
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)
コード例 #2
0
# 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)