public class SchedulerServiceImpl extends BaseLensService implements SchedulerService
Modifier and Type | Class and Description |
---|---|
static class |
SchedulerServiceImpl.WaitingInstanceHandler |
BaseLensService.SessionContext
NAME
Constructor and Description |
---|
SchedulerServiceImpl(org.apache.hive.service.cli.CLIService cliService)
Instantiates a new scheduler service.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle)
Delete a job.
|
void |
expireJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle)
End a job by specifying an expiry time.
|
AlarmService |
getAlarmService() |
List<SchedulerJobHandle> |
getAllJobs(String user,
SchedulerJobState state,
Long start,
Long end)
Get all jobs matching the filter parameters.
|
Collection<SchedulerJobStats> |
getAllJobStats(String state,
String user,
String jobName,
long startTime,
long endTime) |
HealthStatus |
getHealthStatus()
Returns the health status of the service.
|
SchedulerJobInstanceInfo |
getInstanceDetails(SchedulerJobInstanceHandle instanceHandle)
Instance details for an instance.
|
XJob |
getJobDefinition(SchedulerJobHandle jobHandle)
Returns the definition of a job.
|
SchedulerJobInfo |
getJobDetails(SchedulerJobHandle jobHandle)
Returns the details of a job.
|
List<SchedulerJobInstanceInfo> |
getJobInstances(SchedulerJobHandle jobHandle,
Long numResults)
Returns handles for last
numResults instances for the job. |
SchedulerJobStats |
getJobStats(SchedulerJobHandle handle,
String state,
long startTime,
long endTime)
Returns stats for a job.
|
QueryExecutionService |
getQueryService() |
SchedulerDAO |
getSchedulerDAO() |
SchedulerEventListener |
getSchedulerEventListener() |
SchedulerQueryEventListener |
getSchedulerQueryEventListener() |
void |
init(org.apache.hadoop.hive.conf.HiveConf hiveConf) |
boolean |
killInstance(LensSessionHandle sessionHandle,
SchedulerJobInstanceHandle instanceHandle)
Kills a running job instance.
|
LensSessionHandle |
openSessionAsUser(String user)
Create session as user for scheduling the job with no auth.
|
void |
rerunInstance(LensSessionHandle sessionHandle,
SchedulerJobInstanceHandle instanceHandle)
Reruns a failed/killed/completed job instance.
|
void |
resumeJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle)
Resume a job from a given time.
|
void |
scheduleJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle)
Schedule a job.
|
void |
setQueryService(QueryExecutionService queryService) |
void |
start()
How the restarts are handled?
Get all the instances with state Running or New.
|
void |
stop() |
SchedulerJobHandle |
submitAndScheduleJob(LensSessionHandle sessionHandle,
XJob job)
Submit a job and also schedule it.
|
SchedulerJobHandle |
submitJob(LensSessionHandle sessionHandle,
XJob job)
Submit a job.
|
void |
suspendJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle)
Suspend a job.
|
void |
updateJob(LensSessionHandle sessionHandle,
SchedulerJobHandle jobHandle,
XJob newJobDefinition)
Update a job with new definition.
|
acquire, acquire, closeSession, getCliService, getHiveSessionHandle, getLensConf, getLensConf, getNumberOfSessions, getServerDomain, getSession, getSessionInfo, getSessionManager, getValidPath, openSession, openSession, prepareStopping, readExternal, release, release, removePrefixBeforeURI, restoreSession, validateSession, writeExternal
getHiveConf, getName, getServiceState, getStartTime, register, unregister
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validateSession
public SchedulerServiceImpl(org.apache.hive.service.cli.CLIService cliService) throws LensException
cliService
- the cli serviceLensException
public void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
init
in interface org.apache.hive.service.Service
init
in class org.apache.hive.service.CompositeService
public void start()
start
in interface org.apache.hive.service.Service
start
in class org.apache.hive.service.CompositeService
public void stop()
stop
in interface org.apache.hive.service.Service
stop
in class org.apache.hive.service.CompositeService
public HealthStatus getHealthStatus()
getHealthStatus
in interface HealthCheckable
public LensSessionHandle openSessionAsUser(String user) throws LensException
openSessionAsUser
in interface SchedulerService
LensException
public List<SchedulerJobHandle> getAllJobs(String user, SchedulerJobState state, Long start, Long end) throws LensException
SchedulerService
getAllJobs
in interface SchedulerService
LensException
public SchedulerJobHandle submitJob(LensSessionHandle sessionHandle, XJob job) throws LensException
submitJob
in interface SchedulerService
sessionHandle
- handle for this session.job
- job to be submitted.LensException
- the lens exceptionpublic void scheduleJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle) throws LensException
scheduleJob
in interface SchedulerService
sessionHandle
- handle for the current session.jobHandle
- handle for the job to be scheduled.LensException
- the lens exceptionpublic SchedulerJobHandle submitAndScheduleJob(LensSessionHandle sessionHandle, XJob job) throws LensException
SchedulerService
submitAndScheduleJob
in interface SchedulerService
sessionHandle
- handle for the session.job
- job definition.LensException
- the lens exceptionpublic XJob getJobDefinition(SchedulerJobHandle jobHandle) throws LensException
getJobDefinition
in interface SchedulerService
jobHandle
- handle for the jobLensException
- the lens exceptionpublic SchedulerJobInfo getJobDetails(SchedulerJobHandle jobHandle) throws LensException
getJobDetails
in interface SchedulerService
jobHandle
- handle for the jobLensException
- the lens exceptionpublic void updateJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle, XJob newJobDefinition) throws LensException
Updates will be applied only for newer instances. Running instances will be running with old definition
updateJob
in interface SchedulerService
jobHandle
- handle for the job which you want to update.LensException
- the lens exceptionpublic void expireJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle) throws LensException
expireJob
in interface SchedulerService
sessionHandle
- handle for the current session.jobHandle
- handle for the jobLensException
- the lens exceptionpublic void suspendJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle) throws LensException
If the job is not in scheduled state, it will return true. Once a job is suspended, no further instances of that job will run. Any running instances of that job will continue normally.
suspendJob
in interface SchedulerService
sessionHandle
- handle for the current session.jobHandle
- handle for the jobLensException
- the lens exceptionpublic void resumeJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle) throws LensException
resumeJob
in interface SchedulerService
sessionHandle
- handle for the session.jobHandle
- handle for the jobLensException
- the lens exceptionpublic void deleteJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle) throws LensException
deleteJob
in interface SchedulerService
sessionHandle
- handle for the session.jobHandle
- handle for the jobLensException
- the lens exceptionpublic Collection<SchedulerJobStats> getAllJobStats(String state, String user, String jobName, long startTime, long endTime) throws LensException
getAllJobStats
in interface SchedulerService
state
- filter for status, if specified only jobs in that state will be returned,
if null no entries will be removed from resultuser
- filter for user who submitted the job, if specified only jobs submitted by the given user
will be returned, if not specified no entries will be removed from result on basis of userNamejobName
- filter for jobName, if specified only the jobs with name same as given name will be considered
, else no jobs will be filtered out on the basis of name.startTime
- if specified only instances with scheduleTime after this time will be considered.endTime
- if specified only instances with scheduleTime before this time will be considered.LensException
public SchedulerJobStats getJobStats(SchedulerJobHandle handle, String state, long startTime, long endTime) throws LensException
getJobStats
in interface SchedulerService
handle
- handle for the jobstate
- filter for status, if specified only jobs in that state will be returned,
if null no entries will be removed from resultstartTime
- if specified only instances with scheduleTime after this time will be considered.endTime
- if specified only instances with scheduleTime before this time will be considered.LensException
- the lens exceptionpublic void rerunInstance(LensSessionHandle sessionHandle, SchedulerJobInstanceHandle instanceHandle) throws LensException
If the instance is not in a terminal state, then this operation will be a no-op and will return false.
rerunInstance
in interface SchedulerService
sessionHandle
- handle for the session.instanceHandle
- handle for the instanceLensException
- the lens exceptionpublic List<SchedulerJobInstanceInfo> getJobInstances(SchedulerJobHandle jobHandle, Long numResults) throws LensException
numResults
instances for the job.getJobInstances
in interface SchedulerService
jobHandle
- handle for the jobnumResults
- - number of results to be returned, default 100.LensException
- the lens exceptionpublic boolean killInstance(LensSessionHandle sessionHandle, SchedulerJobInstanceHandle instanceHandle) throws LensException
SchedulerService
If the job instance is already completed or not in running state, this will be a no-op and will return false.
killInstance
in interface SchedulerService
sessionHandle
- handle for the session.instanceHandle
- handle for the instanceLensException
- the lens exceptionpublic SchedulerJobInstanceInfo getInstanceDetails(SchedulerJobInstanceHandle instanceHandle) throws LensException
getInstanceDetails
in interface SchedulerService
instanceHandle
- handle for the instance.LensException
- the lens exception@Generated(value="lombok") public SchedulerDAO getSchedulerDAO()
@Generated(value="lombok") public QueryExecutionService getQueryService()
@Generated(value="lombok") public void setQueryService(QueryExecutionService queryService)
@Generated(value="lombok") public SchedulerEventListener getSchedulerEventListener()
@Generated(value="lombok") public SchedulerQueryEventListener getSchedulerQueryEventListener()
@Generated(value="lombok") public AlarmService getAlarmService()
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.