public interface ServiceRegistry
Jobs they may create to enable asynchronous job handling.| Modifier and Type | Method and Description |
|---|---|
long |
count(String serviceType,
Job.Status status)
Count the number of jobs that match the specified parameters.
|
long |
count(String serviceType,
String host,
String operation,
Job.Status status)
Count the number of jobs executing the given operation in this
Job.Status on this host. |
long |
countByHost(String serviceType,
String host,
Job.Status status)
Count the number of jobs in this
Job.Status on this host |
long |
countByOperation(String serviceType,
String operation,
Job.Status status)
Count the number of jobs running the given operation in this
Job.Status. |
long |
countOfAbnormalServices()
Gets the count of the number of abnormal services across the whole system.
|
Job |
createJob(String type,
String operation)
Create and store a new job that will be dispatched as soon as possible.
|
Job |
createJob(String type,
String operation,
Float jobLoad)
Create and store a new job that will be dispatched as soon as possible.
|
Job |
createJob(String type,
String operation,
List<String> arguments)
Create and store a new job that will be dispatched as soon as possible.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
Float jobLoad)
Create and store a new job that will be dispatched as soon as possible.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload)
Create and store a new job that will be dispatched as soon as possible.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload,
boolean queueable)
Create and store a new job.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload,
boolean queueable,
Float jobLoad)
Create and store a new job.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload,
boolean queueable,
Job parentJob)
Create and store a new job.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload,
boolean queueable,
Job parentJob,
Float jobLoad)
Create and store a new job.
|
Job |
createJob(String type,
String operation,
List<String> arguments,
String payload,
Float jobLoad)
Create and store a new job that will be dispatched as soon as possible.
|
void |
disableHost(String host)
Disables a Opencast server from service.
|
void |
enableHost(String host)
Enable an inactive host as a provider of Opencast services.
|
List<Job> |
getActiveJobs()
Get the list of active jobs.
|
List<Job> |
getChildJobs(long id)
Get all child jobs from a job
|
SystemLoad |
getCurrentHostLoads()
Gets a map of hosts to the number of jobs currently loading that host
|
Job |
getCurrentJob()
Gets the current running job
|
HostRegistration |
getHostRegistration(String hostname)
Finds host registration for the given hostname.
|
List<HostRegistration> |
getHostRegistrations()
Finds all host registrations, including offline hosts and those in maintenance mode.
|
Job |
getJob(long id)
Gets a receipt by its ID, or null if not found
|
int |
getJobCount(String operation)
Return the number of jobs for a specified operation type.
|
List<String> |
getJobPayloads(String operation)
Return the payload of all jobs for a specified operation type.
|
List<String> |
getJobPayloads(String operation,
int limit,
int offset)
Return the payload of a specified number of jobs for a specified operation type.
|
List<Job> |
getJobs(String serviceType,
Job.Status status)
Gets the list of jobs that match the specified parameters.
|
SystemLoad.NodeLoad |
getMaxLoadOnNode(String host)
Returns the maximum load that can be handled by a given node.
|
SystemLoad |
getMaxLoads()
Returns the maximum load that can be handled by the currently registered hosts.
|
float |
getOwnLoad()
Gets the load value for the current host (ie, the host this service registry lives on
|
String |
getRegistryHostname()
Returns the service regstry's hostname.
|
ServiceRegistration |
getServiceRegistration(String serviceType,
String host)
Finds a single service registration by host and type, even if the service is offline or in maintenance mode.
|
List<ServiceRegistration> |
getServiceRegistrations()
Finds all service registrations, including offline services and those in maintenance mode.
|
List<ServiceRegistration> |
getServiceRegistrationsByHost(String host)
Finds the service registrations on the given host, including offline services and those in maintenance mode.
|
List<ServiceRegistration> |
getServiceRegistrationsByLoad(String serviceType)
Finds the service registrations for this kind of job, ordered by load (lightest to heaviest).
|
List<ServiceRegistration> |
getServiceRegistrationsByType(String serviceType)
Finds the service registrations for this kind of job, including offline services and those in maintenance mode.
|
List<ServiceStatistics> |
getServiceStatistics()
Gets performance and runtime statistics for each known service registration.
|
Incidents |
incident()
Return a facility to record job incidents.
|
void |
registerHost(String host,
String address,
String nodeName,
long memory,
int cores,
float maxLoad)
Registers a host as a provider of Opencast services.
|
ServiceRegistration |
registerService(String serviceType,
String host,
String path)
Registers a host to handle a specific type of job
|
ServiceRegistration |
registerService(String serviceType,
String host,
String path,
boolean jobProducer)
Registers a host to handle a specific type of job
|
void |
removeJobs(List<Long> ids)
Deletes the given jobs from the service registry
|
void |
removeParentlessJobs(int lifetime)
Removes all jobs which do not have a parent job (except workflow instance jobs) and which have passed their
lifetime.
|
void |
sanitize(String serviceType,
String host)
Sets the given service to NORMAL state
|
void |
setCurrentJob(Job job)
Sets the current running job
|
void |
setMaintenanceStatus(String host,
boolean maintenance)
Sets a registered host's maintenance status
|
void |
unregisterHost(String host)
Removes an Opencast server from service.
|
void |
unRegisterService(String serviceType,
String host)
Unregisters a host from handling a specific type of job
|
Job |
updateJob(Job job)
Update the job in the database
|
void registerHost(String host, String address, String nodeName, long memory, int cores, float maxLoad) throws ServiceRegistryException
host - The base URL for this serveraddress - The IP address of this hostnodeName - Human readable description of this nodememory - The allocated memory of this hostcores - The available cores of this hostmaxLoad - the maximum load this host can supportServiceRegistryException - if communication with the service registry failsvoid unregisterHost(String host) throws ServiceRegistryException
host - The base URL for this serverServiceRegistryException - if communication with the service registry failsvoid enableHost(String host) throws ServiceRegistryException, NotFoundException
host - The base URL for this serverNotFoundException - if the host does not existServiceRegistryException - if communication with the service registry failsvoid disableHost(String host) throws ServiceRegistryException, NotFoundException
host - The base URL for this serverNotFoundException - if the host does not existServiceRegistryException - if communication with the service registry failsSystemLoad getMaxLoads() throws ServiceRegistryException
ServiceRegistryException - if communication with the service registry failsSystemLoad.NodeLoad getMaxLoadOnNode(String host) throws ServiceRegistryException, NotFoundException
host - The base URL for this serverServiceRegistryException - if communication with the service registry failsNotFoundExceptionSystemLoad getCurrentHostLoads() throws ServiceRegistryException
ServiceRegistryExceptionfloat getOwnLoad()
throws ServiceRegistryException
ServiceRegistryExceptionServiceRegistration registerService(String serviceType, String host, String path) throws ServiceRegistryException
serviceType - The job typehost - The base URL where the service that can handle this service type can be foundpath - The path to the service endpointServiceRegistryException - if communication with the service registry failsServiceRegistration registerService(String serviceType, String host, String path, boolean jobProducer) throws ServiceRegistryException
serviceType - The service typehost - The base URL where the service that can handle this job type can be foundpath - The path to the service endpointjobProducer - Whether this service registration produces Jobs to track long running operationsServiceRegistryException - if communication with the service registry failsvoid unRegisterService(String serviceType, String host) throws ServiceRegistryException
serviceType - The service typehost - The base URL where the service that can handle this job type can be foundServiceRegistryException - if communication with the service registry failsvoid setMaintenanceStatus(String host, boolean maintenance) throws ServiceRegistryException, NotFoundException
host - The base URL where the service that can handle this service type can be foundmaintenance - the new maintenance status for this serviceServiceRegistryException - if communication with the service registry failsNotFoundException - if the host does not existJob createJob(String type, String operation) throws ServiceRegistryException
createJob(String, String, List, String, boolean) with an empty argument list.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, Float jobLoad) throws ServiceRegistryException
createJob(String, String, List, String, boolean) with an empty argument list.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runjobLoad - the load caused by this job, roughly equivalent to the number of cores used this jobServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments) throws ServiceRegistryException
createJob(String, String, List, String, boolean).
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, Float jobLoad) throws ServiceRegistryException
createJob(String, String, List, String, boolean).
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationjobLoad - the load caused by this job, roughly equivalent to the number of cores used this jobServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload) throws ServiceRegistryException
createJob(String, String, List, String, boolean). The job will carry the given payload from the beginning.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload, Float jobLoad) throws ServiceRegistryException
createJob(String, String, List, String, boolean). The job will carry the given payload from the beginning.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadjobLoad - the load caused by this job, roughly equivalent to the number of cores used this jobServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload, boolean queueable) throws ServiceRegistryException
enqueueImmediately is true, the job will be in the
Job.Status.QUEUED state and will be dispatched as soon as possible. Otherwise, it will be
Job.Status.INSTANTIATED.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadqueueable - whether the job can be enqueued for dispatch. If false, the job's initial state will be
Job.Status.INSTANTIATED and will not be dispatched.ServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Float jobLoad) throws ServiceRegistryException
enqueueImmediately is true, the job will be in the
Job.Status.QUEUED state and will be dispatched as soon as possible. Otherwise, it will be
Job.Status.INSTANTIATED.
Note that this job will be linked to the current job as its parent. Use
createJob(String, String, List, String, boolean, Job) and pass null as the job if you don't
need the link.
type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadqueueable - whether the job can be enqueued for dispatch. If false, the job's initial state will be
Job.Status.INSTANTIATED and will not be dispatched.jobLoad - the load caused by this job, roughly equivalent to the number of cores used this jobServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Job parentJob) throws ServiceRegistryException
enqueueImmediately is true, the job will be in the
Job.Status.QUEUED state and will be dispatched as soon as possible. Otherwise, it will be
Job.Status.INSTANTIATED.type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadqueueable - whether the job can be enqueued for dispatch. If false, the job's initial state will be
Job.Status.INSTANTIATED and will not be dispatched.parentJob - the parent jobServiceRegistryException - if there is a problem creating the jobJob createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Job parentJob, Float jobLoad) throws ServiceRegistryException
enqueueImmediately is true, the job will be in the
Job.Status.QUEUED state and will be dispatched as soon as possible. Otherwise, it will be
Job.Status.INSTANTIATED.type - the type of service responsible for this joboperation - the operation for this service to runarguments - the arguments to the operationpayload - an optional initial payloadqueueable - whether the job can be enqueued for dispatch. If false, the job's initial state will be
Job.Status.INSTANTIATED and will not be dispatched.parentJob - the parent jobjobLoad - the load caused by this job, roughly equivalent to the number of cores used this jobServiceRegistryException - if there is a problem creating the jobJob updateJob(Job job) throws NotFoundException, ServiceRegistryException
job - NotFoundException - if the job does not existServiceRegistryException - if there is a problem updating the jobJob getJob(long id) throws NotFoundException, ServiceRegistryException
id - the job idNotFoundExceptionServiceRegistryExceptionvoid removeJobs(List<Long> ids) throws NotFoundException, ServiceRegistryException
ids - the job idsNotFoundExceptionServiceRegistryExceptionvoid removeParentlessJobs(int lifetime)
throws ServiceRegistryException
lifetime - lifetime in daysServiceRegistryException - if removing the jobs failsJob getCurrentJob()
void setCurrentJob(Job job)
job - the current jobList<Job> getJobs(String serviceType, Job.Status status) throws ServiceRegistryException
serviceType - The jobs run by this type of service. If null, jobs from all hosts will be returned.status - The status of the jobs. If null, jobs in all status will be returned.ServiceRegistryException - if there is a problem accessing the service registryList<String> getJobPayloads(String operation) throws ServiceRegistryException
operation - Operation type to get payload forServiceRegistryException - if there is a problem accessing the service registryList<String> getJobPayloads(String operation, int limit, int offset) throws ServiceRegistryException
operation - Operation type to get payload forlimit - How many results to returnoffset - Offset for the set of returned resultsServiceRegistryException - if there is a problem accessing the service registryint getJobCount(String operation) throws ServiceRegistryException
operation - Operation type to check forServiceRegistryExceptionList<Job> getActiveJobs() throws ServiceRegistryException
ServiceRegistryException - if there is a problem accessing the service registryList<Job> getChildJobs(long id) throws ServiceRegistryException
id - the parent job idServiceRegistryException - if there is a problem accessing the service registryList<ServiceRegistration> getServiceRegistrationsByLoad(String serviceType) throws ServiceRegistryException
serviceType - The type of service that must be handled by the hostsServiceRegistryException - if there is a problem accessing the service registryList<ServiceRegistration> getServiceRegistrationsByType(String serviceType) throws ServiceRegistryException
serviceType - The type of service that must be handled by the hostsServiceRegistryException - if there is a problem accessing the service registryList<ServiceRegistration> getServiceRegistrationsByHost(String host) throws ServiceRegistryException
host - The hostServiceRegistryException - if there is a problem accessing the service registryServiceRegistration getServiceRegistration(String serviceType, String host) throws ServiceRegistryException
serviceType - The type of servicehost - the base URL of the hostServiceRegistryException - if there is a problem accessing the service registryList<ServiceRegistration> getServiceRegistrations() throws ServiceRegistryException
ServiceRegistryException - if there is a problem accessing the service registryString getRegistryHostname()
List<HostRegistration> getHostRegistrations() throws ServiceRegistryException
ServiceRegistryException - if there is a problem accessing the service registryHostRegistration getHostRegistration(String hostname) throws ServiceRegistryException
hostname - to lookupServiceRegistryException - if there is a problem accessing the service registry or the hostname is not foundList<ServiceStatistics> getServiceStatistics() throws ServiceRegistryException
ServiceRegistryException - if there is a problem accessing the service registrylong countOfAbnormalServices()
throws ServiceRegistryException
ServiceRegistryExceptionlong count(String serviceType, Job.Status status) throws ServiceRegistryException
serviceType - The jobs run by this type of service. If null, the returned count will refer to all types of jobs.status - The status of the receipts. If null, the returned count will refer to jobs in any status.ServiceRegistryException - if there is a problem accessing the service registrylong countByOperation(String serviceType, String operation, Job.Status status) throws ServiceRegistryException
Job.Status.serviceType - The jobs run by this type of serviceoperation - the operationstatus - The status of the jobsServiceRegistryException - if there is a problem accessing the service registrylong countByHost(String serviceType, String host, Job.Status status) throws ServiceRegistryException
Job.Status on this hostserviceType - The jobs run by this type of servicehost - The server that created and will be handling the jobstatus - The status of the jobsServiceRegistryException - if there is a problem accessing the service registrylong count(String serviceType, String host, String operation, Job.Status status) throws ServiceRegistryException
Job.Status on this host.serviceType - The jobs run by this type of servicehost - The server that created and will be handling the joboperation - the operationstatus - The status of the jobsServiceRegistryException - if there is a problem accessing the service registryvoid sanitize(String serviceType, String host) throws NotFoundException
serviceType - the service typehost - the hostNotFoundException - if the service does not existCopyright © 2009–2020 Opencast Project. All rights reserved.