Package cz.metacentrum.perun.core.api
Interface TasksManager
- All Known Implementing Classes:
TasksManagerEntry
public interface TasksManager
TasksManager
-
Method Summary
Modifier and TypeMethodDescriptionint
Get number of Tasks in DB.void
deleteTask
(PerunSession sess, Task task) Delete Task and it's TaskResults.void
deleteTaskResultById
(PerunSession sess, int taskResultId) Delete TaskResult by its IDvoid
deleteTaskResults
(PerunSession sess, Task task, Destination destination) Delete all TaskResults related to specified Task and Destinationvoid
deleteTaskResultsByIds
(PerunSession sess, List<Integer> taskResultIds) Delete TaskResults by their IDs.getAllFacilitiesStates
(PerunSession session) Return propagation status of all facilities in PerungetAllFacilitiesStatesForVo
(PerunSession session, Vo vo) Return propagation status of all facilities related to VO resourcesgetFacilityServicesState
(PerunSession sess, Facility facility) Returns list of ServiceStates for given facility.getFacilityState
(PerunSession session, Facility facility) Return propagation status of facilitygetResourcesState
(PerunSession session, Vo vo) Returns list of ResourceStates for VO.getTask
(PerunSession perunSession, Service service, Facility facility) Find Task for given Service and Facility.getTaskById
(PerunSession perunSession, int id) Retrieve Task given its id.getTaskResultById
(PerunSession session, int readInt) Get TaskResult given its id.getTaskResults
(PerunSession perunSession) Get all TaskResults.getTaskResultsByDestinations
(PerunSession session, List<String> destinationsNames) Returns task results for defined destinations (string representation).getTaskResultsByTask
(PerunSession sess, int taskId) Get all TaskResult's for given TaskgetTaskResultsByTaskAndDestination
(PerunSession session, int taskId, int destinationId) Find all task results for given task and destination.getTaskResultsByTaskOnlyNewest
(PerunSession session, int taskId) Retrieve the newest task results for given task.boolean
Check if propagating tasks to engine is suspended via the DB flag CAREFUL: even if not suspended though DB, can be disabled temporarily through synced fieldboolean
isThereSuchTask
(PerunSession session, Service service, Facility facility) Check if if there is a task for given service and facility.listAllTasks
(PerunSession perunSession) Retrieve all task results.listAllTasksForFacility
(PerunSession session, int facilityId) Returns all tasks associated with selected facilitylistAllTasksInState
(PerunSession perunSession, Task.TaskStatus state) Retrieve all tasks in given statevoid
suspendTasksPropagation
(PerunSession perunSession, boolean suspend, boolean persistently) Suspends tasks propagation to engine.
-
Method Details
-
countTasks
int countTasks()Get number of Tasks in DB.- Returns:
- Number of tasks.
-
deleteTask
Delete Task and it's TaskResults. Use this method only before deleting whole Facility.- Parameters:
sess
- PerunSessiontask
- Task to delete- Throws:
InternalErrorException
PrivilegeException
-
deleteTaskResultById
Delete TaskResult by its ID- Parameters:
sess
- PerunSessiontaskResultId
- Id of TaskResults to be deleted- Throws:
PrivilegeException
-
deleteTaskResults
void deleteTaskResults(PerunSession sess, Task task, Destination destination) throws PrivilegeException Delete all TaskResults related to specified Task and Destination- Parameters:
sess
- PerunSessiontask
- Task to have TaskResults deleteddestination
- Destination to have TasksResults deleted- Throws:
PrivilegeException
-
deleteTaskResultsByIds
void deleteTaskResultsByIds(PerunSession sess, List<Integer> taskResultIds) throws PrivilegeException, FacilityMismatchException Delete TaskResults by their IDs. TaskResults are expected to be from the same facility.- Parameters:
sess
- sesstaskResultIds
- list of ids- Throws:
PrivilegeException
FacilityMismatchException
- when the Tasks are not from the same facility
-
getAllFacilitiesStates
Return propagation status of all facilities in Perun- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
PrivilegeException
InternalErrorException
FacilityNotExistsException
-
getAllFacilitiesStatesForVo
List<FacilityState> getAllFacilitiesStatesForVo(PerunSession session, Vo vo) throws PrivilegeException, VoNotExistsException, FacilityNotExistsException Return propagation status of all facilities related to VO resources- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
PrivilegeException
InternalErrorException
FacilityNotExistsException
VoNotExistsException
-
getFacilityServicesState
List<ServiceState> getFacilityServicesState(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Returns list of ServiceStates for given facility. It lists states for all services, which are currently assigned to the facility or has any Task related to this facility.So results are returned even when there was no previous propagation of such service or service is no longer assigned.
- Parameters:
sess
- PerunSessionfacility
-- Returns:
- list of ServiceStates
- Throws:
InternalErrorException
PrivilegeException
FacilityNotExistsException
-
getFacilityState
FacilityState getFacilityState(PerunSession session, Facility facility) throws PrivilegeException, FacilityNotExistsException Return propagation status of facility- Parameters:
session
-facility
-- Returns:
- propagation status of facility
- Throws:
FacilityNotExistsException
PrivilegeException
InternalErrorException
-
getResourcesState
List<ResourceState> getResourcesState(PerunSession session, Vo vo) throws PrivilegeException, VoNotExistsException Returns list of ResourceStates for VO.- Parameters:
session
- PerunSessionvo
- VirtualOrganization- Returns:
- list of ResourceStates
- Throws:
PrivilegeException
VoNotExistsException
InternalErrorException
-
getTask
Task getTask(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Find Task for given Service and Facility.- Parameters:
perunSession
-service
-facility
-- Returns:
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
getTaskById
Retrieve Task given its id.- Parameters:
perunSession
-id
-- Returns:
- Task with given id
- Throws:
PrivilegeException
-
getTaskResultById
Get TaskResult given its id.- Parameters:
session
-readInt
-- Returns:
- TaskResult
-
getTaskResults
Get all TaskResults.- Parameters:
perunSession
-- Returns:
- List of TaskResult
-
getTaskResultsByDestinations
Returns task results for defined destinations (string representation).- Parameters:
session
-destinationsNames
-- Returns:
- list of tasks results
-
getTaskResultsByTask
Get all TaskResult's for given Task- Parameters:
sess
-taskId
-- Returns:
- List of TaskResult
- Throws:
PrivilegeException
-
getTaskResultsByTaskAndDestination
List<TaskResult> getTaskResultsByTaskAndDestination(PerunSession session, int taskId, int destinationId) throws DestinationNotExistsException, FacilityNotExistsException, PrivilegeException Find all task results for given task and destination.- Parameters:
session
-taskId
-destinationId
-- Returns:
- List of TaskResult
- Throws:
DestinationNotExistsException
FacilityNotExistsException
PrivilegeException
-
getTaskResultsByTaskOnlyNewest
List<TaskResult> getTaskResultsByTaskOnlyNewest(PerunSession session, int taskId) throws PrivilegeException Retrieve the newest task results for given task.- Parameters:
session
-taskId
-- Returns:
- List of TaskResult
- Throws:
PrivilegeException
-
isThereSuchTask
boolean isThereSuchTask(PerunSession session, Service service, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Check if if there is a task for given service and facility.- Parameters:
session
-service
-facility
-- Returns:
- true if task exists, false otherwise
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
isSuspendedTasksPropagationPersistently
Check if propagating tasks to engine is suspended via the DB flag CAREFUL: even if not suspended though DB, can be disabled temporarily through synced field- Returns:
- True if suspended in DB, false otherwise
- Throws:
PrivilegeException
- insufficient rights
-
listAllTasks
Retrieve all task results.- Parameters:
perunSession
-- Returns:
- List of TaskResult
- Throws:
PrivilegeException
-
listAllTasksForFacility
Returns all tasks associated with selected facility- Parameters:
session
-facilityId
-- Returns:
- all tasks for facility
- Throws:
PrivilegeException
-
listAllTasksInState
List<Task> listAllTasksInState(PerunSession perunSession, Task.TaskStatus state) throws PrivilegeException Retrieve all tasks in given state- Parameters:
perunSession
-state
-- Returns:
- List of Task
- Throws:
PrivilegeException
-
suspendTasksPropagation
void suspendTasksPropagation(PerunSession perunSession, boolean suspend, boolean persistently) throws PrivilegeException Suspends tasks propagation to engine.- Parameters:
perunSession
-suspend
- True to suspend propagation, false to resume propagationpersistently
- True for the change to persist even after Perun restart- Throws:
PrivilegeException
-