|
| 1 | +######################################################################### |
| 2 | +# reservation.pxd - interface to work with reservations in slurm |
| 3 | +######################################################################### |
| 4 | +# Copyright (C) 2025 Toni Harzendorf <[email protected]> |
| 5 | +# |
| 6 | +# This file is part of PySlurm |
| 7 | +# |
| 8 | +# PySlurm is free software; you can redistribute it and/or modify |
| 9 | +# it under the terms of the GNU General Public License as published by |
| 10 | +# the Free Software Foundation; either version 2 of the License, or |
| 11 | +# (at your option) any later version. |
| 12 | + |
| 13 | +# PySlurm is distributed in the hope that it will be useful, |
| 14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +# GNU General Public License for more details. |
| 17 | +# |
| 18 | +# You should have received a copy of the GNU General Public License along |
| 19 | +# with PySlurm; if not, write to the Free Software Foundation, Inc., |
| 20 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | +# |
| 22 | +# cython: c_string_type=unicode, c_string_encoding=default |
| 23 | +# cython: language_level=3 |
| 24 | + |
| 25 | +from libc.string cimport memcpy, memset |
| 26 | +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t |
| 27 | +from libc.stdlib cimport free |
| 28 | +from pyslurm cimport slurm |
| 29 | +from pyslurm.slurm cimport ( |
| 30 | + reserve_info_t, |
| 31 | + reserve_info_msg_t, |
| 32 | + resv_desc_msg_t, |
| 33 | + reservation_name_msg_t, |
| 34 | + reserve_response_msg_t, |
| 35 | + slurm_free_reservation_info_msg, |
| 36 | + slurm_load_reservations, |
| 37 | + slurm_delete_reservation, |
| 38 | + slurm_update_reservation, |
| 39 | + slurm_create_reservation, |
| 40 | + slurm_init_resv_desc_msg, |
| 41 | + xfree, |
| 42 | + try_xmalloc, |
| 43 | +) |
| 44 | + |
| 45 | +from pyslurm.utils cimport cstr |
| 46 | +from pyslurm.utils cimport ctime |
| 47 | +from pyslurm.utils.ctime cimport time_t |
| 48 | +from pyslurm.utils.uint cimport * |
| 49 | +from pyslurm.xcollections cimport MultiClusterMap |
| 50 | + |
| 51 | +cdef extern void slurm_free_resv_desc_msg(resv_desc_msg_t *msg) |
| 52 | +cdef extern void slurm_free_reserve_info_members(reserve_info_t *resv) |
| 53 | + |
| 54 | + |
| 55 | +cdef class Reservations(MultiClusterMap): |
| 56 | + |
| 57 | + cdef: |
| 58 | + reserve_info_msg_t *info |
| 59 | + reserve_info_t tmp_info |
| 60 | + |
| 61 | + |
| 62 | +cdef class Reservation: |
| 63 | + |
| 64 | + cdef: |
| 65 | + reserve_info_t *info |
| 66 | + resv_desc_msg_t *umsg |
| 67 | + dict passwd |
| 68 | + dict groups |
| 69 | + |
| 70 | + cdef readonly cluster |
| 71 | + |
| 72 | + @staticmethod |
| 73 | + cdef Reservation from_ptr(reserve_info_t *in_ptr) |
0 commit comments