123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- ###############################################################################
- # #
- # L3q - Light, light, lightweight queue #
- # Copyright (C) 2023 Marcus Pedersén marcus.pedersen@slu.se #
- # #
- # This program is free software: you can redistribute it and/or modify #
- # it under the terms of the GNU General Public License as published by #
- # the Free Software Foundation, either version 3 of the License, or #
- # (at your option) any later version. #
- # #
- # This program is distributed in the hope that it will be useful, #
- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
- # GNU General Public License for more details. #
- # #
- # You should have received a copy of the GNU General Public License #
- # along with this program. If not, see <http://www.gnu.org/licenses/>. #
- # #
- ###############################################################################
- '''
- Module contains action classes
- and functions for l3q,
- required by both daemon, node and client programs.
- Action classes are sent as json strings
- over https between different l3q programs.
- '''
- class Action():
- '''
- Base class for actions.
- Subclasses should specify
- needed required slots.
- '''
- __slots__ = ['validate']
-
- def __init__(self) -> None:
- self.validate: str = ""
- '''
- Client Action classes.
- To be sent as json
- to l3q darmon.
- '''
- class CAValidateKey(Action):
- '''
- Client action: Validate Key
- '''
- __slots__: list[str] = ['password', 'hostname']
- def __init__(self) -> None:
- self.password: str = ""
- self.hostname: str = ""
-
- class CAGetQueue(Action):
- '''
- Client action: Get Queue
- '''
- __slots__: list[str] = []
- def __init__(self) -> None:
- pass
- class CAGetHistory(Action):
- '''
- Client action: Get History
- '''
- __slots__: list[str] = []
- def __init__(self) -> None:
- pass
- class CAGetNodeStatus(Action):
- '''
- Client action: Get Node Status
- '''
- __slots__: list[str] = []
- def __init__(self) -> None:
- pass
- class CAGetJobInfo(Action):
- '''
- Client action: Get Job Info
- '''
- __slots__ = ['jobid']
- def __init__(self) -> None:
- self.jobid: int = 0
- class CAGetTaskInfo(Action):
- '''
- Client action: Get Task Info
- '''
- __slots__ = ['taskid']
- def __init__(self) -> None:
- self.taskid: int = 0
- class CAGetTaskList(Action):
- '''
- Client action: Get Task List
- '''
- __slots__ = ['jobid']
- def __init__(self) -> None:
- self.jobid: int = 0
- class CASetNodeOnline(Action):
- '''
- Client action: Set Node Online
- '''
- __slots__ = ['node_name']
- def __init__(self) -> None:
- self.node_name: str = ""
- class CASetNodeOffline(Action):
- '''
- Client action: Set Node Offline
- '''
- __slots__ = ['node_name']
- def __init__(self) -> None:
- self.node_name: str = ""
- class CAAddParallel(Action):
- '''
- Client action: Add Parallel Job
- '''
- __slots__ = ['user', 'name','tasks', 'nodes', 'cores', 'memory', 'depend']
- def __init__(self) -> None:
- self.user: str = ""
- self.name: str = ""
- self.tasks: list[str] = []
- self.nodes: int = 0
- self.cores: int = 0
- self.memory: int = 0
- self.depend: list[int]
- class CAAddSequence(Action):
- '''
- Client action: Add Sequence Job
- '''
- __slots__ = ['user', 'name','tasks', 'cores', 'memory', 'depend']
- def __init__(self) -> None:
- self.user: str = ""
- self.name: str = ""
- self.tasks: list[str] = []
- self.cores: int = 1
- self.memory: int = 0
- self.depend: list[int]
- class CACancelJob(Action):
- '''
- Client action: Cancel Job
- '''
- __slots__ = ['jobid', 'user']
- def __init__(self) -> None:
- self.jobid: int = 0
- self.user: str = ""
|