public abstract class AbstractSmartProxy<T extends JobTracker> extends Object implements Scheduler, SchedulerEventListener
Smart proxy is a proxy to the Scheduler with built-in support for automatic data pushing and pulling in order to provide disconnected mode for the dataspace layer.
Modifier and Type | Field and Description |
---|---|
protected SchedulerEvent[] |
configuredEvents |
protected ConnectionInfo |
connectionInfo |
protected Set<SchedulerEventListenerExtended> |
eventListeners |
static String |
GENERIC_INFO_INPUT_FOLDER_PROPERTY_NAME |
static String |
GENERIC_INFO_OUTPUT_FOLDER_PROPERTY_NAME |
static String |
GENERIC_INFO_PULL_URL_PROPERTY_NAME |
static String |
GENERIC_INFO_PUSH_URL_PROPERTY_NAME |
protected T |
jobTracker |
static int |
MAX_NB_OF_DATA_TRANSFER_THREADS |
protected static SchedulerEvent[] |
PROXY_SCHED_EVENTS |
protected boolean |
terminated |
protected boolean |
terminating |
protected ExecutorService |
threadPool |
Constructor and Description |
---|
AbstractSmartProxy() |
AbstractSmartProxy(T jobTracker) |
Modifier and Type | Method and Description |
---|---|
protected abstract Scheduler |
_getScheduler()
Returns a proxy instance to the Scheduler.
|
SchedulerState |
addEventListener(SchedulerEventListener sel,
boolean myEventsOnly,
boolean getCurrentState,
SchedulerEvent... events)
Add a scheduler event Listener.
|
void |
addEventListener(SchedulerEventListener sel,
boolean myEventsOnly,
SchedulerEvent... events)
Add a scheduler event Listener.
|
void |
addEventListener(SchedulerEventListenerExtended sel) |
abstract void |
addEventListener(SchedulerEventListenerExtended listener,
boolean myEventsOnly,
SchedulerEvent[] events) |
void |
changeJobPriority(JobId jobId,
JobPriority priority)
Change the priority of the job represented by jobId.
Only administrator can change the priority to HIGH, HIGEST, IDLE. |
void |
changeJobPriority(String jobId,
JobPriority priority)
Change the priority of the job represented by jobId.
Only administrator can change the priority to HIGH, HIGEST, IDLE. The jobId is given as a string. |
boolean |
changePolicy(String policyClassName)
For administrator only, change the policy of the scheduler.
|
protected void |
checkInitialized() |
void |
cleanDatabase()
Cleans the DataBase handled by the smart proxy, it will delete all informations tracked.
|
void |
configureEvents(SchedulerEvent... events)
Configure the scheduler events this smart proxy is listening to.
|
protected abstract void |
createFolder(String fUri) |
protected String |
createNewFolderName() |
abstract void |
disconnect()
Disconnect from the scheduler
|
protected abstract void |
downloadTaskOutputFiles(AwaitedJob awaitedjob,
String jobId,
String t_name,
String localFolder)
Pull the output files of the given task from the pull_url either to the localFolder defined for the job or to the localFolder specified as argument, if it is not null.
|
boolean |
freeze()
For administrator only, Freeze the scheduler by terminating running
tasks.
|
List<JobUsage> |
getAccountUsage(String user,
Date startDate,
Date endDate)
Returns details on job and task execution times for a given user's executions.
|
String |
getCurrentPolicy()
Return the name of the current Policy
|
abstract List<String> |
getGlobalSpaceURIs()
Returns the GLOBAL DataSpace URI available to all users
|
JobResult |
getJobResult(JobId jobId)
Get the result for the given jobId.
|
JobResult |
getJobResult(String jobId)
Get the result for the given jobId.
The jobId is given as a string. |
Page<JobInfo> |
getJobs(int offset,
int limit,
JobFilterCriteria filterCriteria,
List<SortParameter<JobSortParameter>> sortParameters)
Retrieves a job list of the scheduler.
|
String |
getJobServerLogs(String id)
Retrieves server logs for a job with the given id.
|
List<JobInfo> |
getJobsInfoList(List<String> jobsId)
Returns a list of jobs info corresponding to the given job IDs (in the same order)
|
JobState |
getJobState(JobId jobId)
Return the state of the given job.
The state contains informations about the job, every tasks and informations about the tasks. A user can only get the state of HIS job. If the job does not exist, a schedulerException is sent with the proper message. |
abstract JobState |
getJobState(String jobId)
Return the state of the given job.
The state contains informations about the job, every tasks and informations about the tasks. The jobId is given as a string. |
Map |
getJobsToSchedule()
get job Descriptor Map with eligible jobs (running and pending)
|
List<JobUsage> |
getMyAccountUsage(Date startDate,
Date endDate)
Returns details on job and task execution times for the caller's executions.
|
SchedulerState |
getState()
Get the list of job states that describe every jobs in the Scheduler.
|
SchedulerState |
getState(boolean myJobsOnly)
Get the list of job states that describe every jobs in the Scheduler.
|
SchedulerStatus |
getStatus()
Get the current status of the Scheduler
|
TaskResult |
getTaskResult(JobId jobId,
String taskName)
Get the result for the given task name in the given jobId.
|
abstract TaskResult |
getTaskResult(String jobId,
String taskName)
Get the result for the given task name in the given jobId.
|
List<TaskResult> |
getTaskResultAllIncarnations(JobId jobId,
String taskName)
Get the result for the given task name and all result incarnations in the
given jobId.
|
List<TaskResult> |
getTaskResultAllIncarnations(String jobId,
String taskName)
Get the result for the given task name and all result incarnations in the
given jobId.
|
TaskResult |
getTaskResultFromIncarnation(JobId jobId,
String taskName,
int inc)
Get the result for the given task name and the given incarnation in the
given jobId.
|
TaskResult |
getTaskResultFromIncarnation(String jobId,
String taskName,
int inc)
Get the result for the given task name and the given incarnation in the
given jobId.
|
List<TaskResult> |
getTaskResultsByTag(JobId jobId,
String taskTag)
Get the results for a set of tasks in the given jobId and filtered by a
given tag.
|
List<TaskResult> |
getTaskResultsByTag(String jobId,
String taskTag)
Get the results for a set of tasks in the given jobId and filtered by a
given tag.
|
String |
getTaskServerLogs(String id,
String taskName)
Retrieves server logs for a task with the given id.
|
String |
getTaskServerLogsByTag(String id,
String taskTag)
Retrieves server logs for a set of tasks filtered by the given tag.
|
List<TaskDescriptor> |
getTasksToSchedule()
get task descriptor list with eligible tasks (running)
|
List<SchedulerUserInfo> |
getUsers()
Returns a list of connected users.
|
abstract List<String> |
getUserSpaceURIs()
Returns the USER DataSpace URIs associated with the current user
|
List<SchedulerUserInfo> |
getUsersWithJobs()
Returns a list of users having jobs.
|
abstract void |
init(ConnectionInfo connectionInfo)
Connects to the scheduler
|
boolean |
isConnected()
Test whether or not the user is connected to the ProActive Scheduler.
|
void |
jobStateUpdatedEvent(NotificationData<JobInfo> notification)
Invoked each time the state of a job has changed.
If you want to maintain an up to date list of jobs, just use the JobState.update(org.ow2.proactive.scheduler.common.job.JobInfo)
method to update the content of your job. |
void |
jobSubmittedEvent(JobState job)
Invoked each time a new job has been submitted to the Scheduler and validated.
|
void |
jobUpdatedFullDataEvent(JobState job)
Invoked each time the state of a job has changed and each time a scheduler event occurs.
|
boolean |
kill()
For administrator only, Kill the scheduler.
Will stop the scheduling, and shutdown the scheduler. |
boolean |
killJob(JobId jobId)
Kill the job represented by jobId.
This method will kill every running tasks of this job, and remove it from the scheduler. The job won't be terminated, it won't have result. |
boolean |
killJob(String jobId)
Kill the job represented by jobId.
This method will kill every running tasks of this job, and remove it from the scheduler. The job won't be terminated, it won't have result. The jobId is given as a string. |
boolean |
killTask(JobId jobId,
String taskName)
Try to kill the task with the given task name in the given jobId.
|
boolean |
killTask(String jobId,
String taskName)
Try to kill the task with the given task name in the given jobId.
|
boolean |
linkResourceManager(String rmURL)
For administrator only, Reconnect a new Resource Manager to the
scheduler.
|
void |
listenJobLogs(JobId jobId,
AppenderProvider appenderProvider)
Listen for the tasks user logs.
|
void |
listenJobLogs(String jobId,
AppenderProvider appenderProvider)
Listen for the tasks user logs.
The jobId is given as a string. |
boolean |
pause()
For administrator only, Pause the scheduler by terminating running jobs.
|
boolean |
pauseJob(JobId jobId)
Pause the job represented by jobId.
This method will finish every running tasks of this job, and then pause the job. The job will have to be resumed in order to finish. |
boolean |
pauseJob(String jobId)
Pause the job represented by jobId.
This method will finish every running tasks of this job, and then pause the job. The job will have to be resumed in order to finish. The jobId is given as a string. |
boolean |
preemptTask(JobId jobId,
String taskName,
int restartDelay)
Try to stop the task execution represented by the given task name in the
given jobId.
|
boolean |
preemptTask(String jobId,
String taskName,
int restartDelay)
Try to stop the task execution represented by the given task name in the
given jobId.
If the job does not exist, an UnknownJobException is sent with the proper message. So, if you have the right to stop this task and if the job and task name exist and is running, the task will be stopped and restarted later and this method will return true .The given delay is the delay between the task termination and it's eligibility to be re-scheduled. |
protected String |
prepareJobInput(Job job,
String localInputFolder,
List<String> pushURLs,
String newFolderName)
This method will create a remote folder for the input data of this job
and update the inputSpace job property.
|
protected String |
prepareJobOutput(TaskFlowJob job,
String localOutputFolder,
List<String> pull_urls,
String newFolderName,
boolean isolateTaskOutputs)
This method will create a remote folder for output of this job and update
the outputSpace job property.
|
void |
pullData(String jobId,
String t_name,
String localFolder)
Transfer the output files associated with the given task to the specified local folder.
|
void |
putThirdPartyCredential(String key,
String value)
Stores a third-party credential key-value pair in the database.
|
void |
reconnect()
Reconnects this smart proxy to the scheduler
|
abstract void |
registerAsListener() |
protected void |
reinitializeState() |
boolean |
reloadPolicyConfiguration()
For administrator only, order a reload to the policy.
|
protected void |
removeAwaitedTask(String jobId,
String taskName)
The method from jobTracker is encapsulated in order to be called via the
SmartProxy stub
|
void |
removeEventListener()
Remove the current event listener your listening on.
If no listener is defined, this method has no effect. |
void |
removeEventListener(SchedulerEventListenerExtended sel) |
boolean |
removeJob(JobId jobId)
Remove the job from the scheduler.
|
boolean |
removeJob(String jobId)
Remove the job from the scheduler.
|
protected abstract void |
removeJobIO(Job job,
String pushURL,
String pullURL,
String newFolderName) |
void |
removeThirdPartyCredential(String key) |
void |
renewSession()
This method renew the connection lease without other side effect.
|
boolean |
restartTask(JobId jobId,
String taskName,
int restartDelay)
Try to restart the task represented by the given task name in the given
jobId.
|
boolean |
restartTask(String jobId,
String taskName,
int restartDelay)
Try to restart the task represented by the given task name in the given
jobId.
|
boolean |
resume()
For administrator only, Resume the scheduler.
|
boolean |
resumeJob(JobId jobId)
Resume the job represented by jobId.
This method will restart every non-finished tasks of this job. |
boolean |
resumeJob(String jobId)
Resume the job represented by jobId.
This method will restart every non-finished tasks of this job. The jobId is given as a string. |
void |
schedulerStateUpdatedEvent(SchedulerEvent eventType)
Invoked each time a scheduler event occurs.
Scheduler events are stopped,started, paused, frozen, etc. |
protected void |
setInitialized(boolean initialized) |
void |
setSessionName(String name)
Sets the name of this recording session.
|
boolean |
shutdown()
For administrator only, Terminate the scheduler after all currently running tasks are finished.
|
boolean |
start()
For administrator only, Start the scheduler.
|
boolean |
stop()
For administrator only, Stop the scheduler.
Once done, you won't be able to submit job, and the scheduling will be stopped. Every running jobs will be terminated. |
abstract JobId |
submit(Job job)
Submit a new job to the scheduler.
|
JobId |
submit(TaskFlowJob job,
String localInputFolderPath,
String localOutputFolderPath,
boolean isolateTaskOutputs,
boolean automaticTransfer)
Submits a job to the scheduler and handle data transfer via the SmartProxy, the dataspace server will be the default user space
|
JobId |
submit(TaskFlowJob job,
String localInputFolderPath,
String pushUrl,
String localOutputFolderPath,
String pullUrl,
boolean isolateTaskOutputs,
boolean automaticTransfer)
Submits a job to the scheduler and handle data transfer via the SmartProxy
|
void |
syncAwaitedJobs()
This method will synchronize this proxy with a remote Scheduler, it will
contact the scheduler and checks the current state of every job being
handled.
|
void |
taskStateUpdatedEvent(NotificationData<TaskInfo> notification)
Invoked each time the state of a task has changed.
In this case you can use the JobState.update(org.ow2.proactive.scheduler.common.task.TaskInfo)
method to update the content of the designated task inside your job. |
void |
terminate()
Terminate the SmartProxy, and release all resources used.
|
Set<String> |
thirdPartyCredentialsKeySet() |
protected void |
updateJob(NotificationData<?> notification)
Check if the job concerned by this notification is awaited.
|
protected void |
updateTask(NotificationData<TaskInfo> notification)
Check if the task concerned by this notification is awaited.
|
abstract boolean |
uploadInputfiles(TaskFlowJob job,
String localInputFolderPath)
Push the input files of the given job from the local input folder to the
location specified by PUSH_URL.
|
void |
usersUpdatedEvent(NotificationData<UserIdentification> notification)
Invoked each time something change about users.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
changeStartAt, checkJobPermissionMethod, finishInErrorTask, getCurrentUser, getCurrentUserData, getJobContent, getJobInfo, getPortalConfiguration, getSchedulerProperties, getTaskIds, getTaskPaginated, getTaskStates, restartAllInErrorTasks, restartInErrorTask
public static final String GENERIC_INFO_INPUT_FOLDER_PROPERTY_NAME
public static final String GENERIC_INFO_OUTPUT_FOLDER_PROPERTY_NAME
public static final String GENERIC_INFO_PUSH_URL_PROPERTY_NAME
public static final String GENERIC_INFO_PULL_URL_PROPERTY_NAME
public static final int MAX_NB_OF_DATA_TRANSFER_THREADS
protected static final SchedulerEvent[] PROXY_SCHED_EVENTS
protected SchedulerEvent[] configuredEvents
protected T extends JobTracker jobTracker
protected ConnectionInfo connectionInfo
protected Set<SchedulerEventListenerExtended> eventListeners
protected final ExecutorService threadPool
protected boolean terminated
protected boolean terminating
public AbstractSmartProxy()
public AbstractSmartProxy(T jobTracker)
public void cleanDatabase()
public void terminate()
public void setSessionName(String name)
name
- name of the session to create or reusepublic void configureEvents(SchedulerEvent... events)
events
- public abstract void init(ConnectionInfo connectionInfo) throws SchedulerException, LoginException
connectionInfo@throws
- SchedulerExceptionLoginException
SchedulerException
public abstract void disconnect() throws PermissionException, NotConnectedException
disconnect
in interface Scheduler
PermissionException
NotConnectedException
public boolean isConnected()
Scheduler
isConnected
in interface Scheduler
public void renewSession() throws NotConnectedException
Scheduler
renewSession
in interface Scheduler
NotConnectedException
- if you are not authenticated.public String getJobServerLogs(String id) throws UnknownJobException, NotConnectedException, PermissionException
Scheduler
getJobServerLogs
in interface Scheduler
id
- of the job for which logs are requestedUnknownJobException
- if the job does not exist.NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public String getTaskServerLogs(String id, String taskName) throws UnknownJobException, UnknownTaskException, NotConnectedException, PermissionException
Scheduler
getTaskServerLogs
in interface Scheduler
id
- of the job where the task is.taskName
- the name of the task.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public String getTaskServerLogsByTag(String id, String taskTag) throws UnknownJobException, NotConnectedException, PermissionException
Scheduler
getTaskServerLogsByTag
in interface Scheduler
id
- of the job where the task is.taskTag
- the tag used to filter tasks.UnknownJobException
- if the job does not exist.NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public Page<JobInfo> getJobs(int offset, int limit, JobFilterCriteria filterCriteria, List<SortParameter<JobSortParameter>> sortParameters) throws NotConnectedException, PermissionException
Scheduler
getJobs
in interface Scheduler
offset
- says to start from this job islimit
- max number of jobs to retrievefilterCriteria
- defines types of job (myonly, pending, running, finished).
Important! If user tries to get all jobs (myonly is false) but
does not have permissions to do it (namely
HandleOnlyMyJobsPermission(true)) user will get his own jobs
instead of a PermissionException. This behavior should
simplify the client design.sortParameters
- defines in how jobs must be sortedNotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public List<JobInfo> getJobsInfoList(List<String> jobsId) throws PermissionException, NotConnectedException
Scheduler
getJobsInfoList
in interface Scheduler
jobsId
- the list of id of the jobs to return, in the same orderPermissionException
- if you have not enough permission to access this method.NotConnectedException
- if you are not authenticated.public List<SchedulerUserInfo> getUsers() throws NotConnectedException, PermissionException
Scheduler
getUsers
in interface Scheduler
NotConnectedException
PermissionException
public List<SchedulerUserInfo> getUsersWithJobs() throws NotConnectedException, PermissionException
Scheduler
SchedulerUsage
getUsersWithJobs
in interface Scheduler
NotConnectedException
PermissionException
public void reconnect() throws SchedulerException, LoginException
SchedulerException
LoginException
public JobId submit(TaskFlowJob job, String localInputFolderPath, String localOutputFolderPath, boolean isolateTaskOutputs, boolean automaticTransfer) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException, Exception
job
- job to submitlocalInputFolderPath
- path to the local directory containing input fileslocalOutputFolderPath
- path to the local directory which will contain output filesisolateTaskOutputs
- if set to true, output files from each tasks will be isolated from each other in the dataspace server (to prevent overlapping)automaticTransfer
- if set to true, output files will be automatically transferred from the dataspace server to the local machine as soon as the task is finished.
If set to false, the files will not be automatically transferred and a call to pullData must be done to transfer filesNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
Exception
public JobId submit(TaskFlowJob job, String localInputFolderPath, String pushUrl, String localOutputFolderPath, String pullUrl, boolean isolateTaskOutputs, boolean automaticTransfer) throws Exception, SubmissionClosedException, JobCreationException
job
- job to submitlocalInputFolderPath
- path to the local directory containing input filespushUrl
- url of the dataspace server used to push input files tolocalOutputFolderPath
- path to the local directory which will contain output filespullUrl
- url of the dataspace server used to pull output files fromisolateTaskOutputs
- if set to true, output files from each tasks will be isolated from each other in the dataspace server (to prevent overlapping)automaticTransfer
- if set to true, output files will be automatically transferred from the dataspace server to the local machine as soon as the task is finished.
If set to false, the files will not be automatically transferred and a call to pullData must be done to transfer filesException
SubmissionClosedException
JobCreationException
public void pullData(String jobId, String t_name, String localFolder) throws Exception
jobId
- id of the jobt_name
- name of the tasklocalFolder
- path to the local directory which will contain output filesException
protected void checkInitialized()
protected void setInitialized(boolean initialized)
protected void reinitializeState() throws NotConnectedException, PermissionException
public void syncAwaitedJobs()
protected String prepareJobOutput(TaskFlowJob job, String localOutputFolder, List<String> pull_urls, String newFolderName, boolean isolateTaskOutputs) throws NotConnectedException, PermissionException
We suppose there is file storage accessible by the client application as well as the tasks on the computation nodes.
This storage could be different for input and for output.
This output storage can be accessed, by the client application, using the pull_url and by the tasks on the nodes using the job's output space url.
Prepare Output Data Transfer
A folder will be created at pull_url/NewFolder/output (which, from the nodes side, is job.OutputSpace/NewFolder/output).
The OutputSpace property of the job will be changed to the new location. job.OutputSpace = job.OutputSpace/NewFolder/output
A generic information will be attached to the job containing the local output folder path If the option isolateTaskOutputs is set, a subfolder of "output" named "[TASKID]" will be created, it will behave as a tag to tell the TaskLauncher to create a subfolder with the real taskid when the task is executed.
job
- localOutputFolder
- path to the output folder on local machine if null, no actions
will be performed concerning the output data for this jobpull_urls
- the urls where the data is to be retrieved after the job is
finishednewFolderName
- name of the folder to be used for pushing the outputisolateTaskOutputs
- task output isolation (see method submit)NotConnectedException
PermissionException
protected String prepareJobInput(Job job, String localInputFolder, List<String> pushURLs, String newFolderName) throws NotConnectedException, PermissionException
We suppose there is file storage accessible by the client application as well as the tasks on the computation nodes.
This storage could be different for input and for output.
The input storage can be accessed, by the client application, using the push_url and by the tasks on the nodes using the job's input space url.
Prepare Input Data Transfer
A folder will be created at push_url/newFolderName/input (which, from the nodes side, is the job.InputSpace/newFolderName/input) . The InputSpace property of the job will be changed to the new location. job.InputSpace = job.InputSpace/NewFolder/input
A generic information will be attached to the job containing the local input folder path.
job
- localInputFolder
- path to the input folder on local machine if null, no actions
will be performed concerning the input data for this jobpushURLs
- the urls where input data is to be pushed before the job
submissionnewFolderName
- name of the new folder to be createdNotConnectedException
PermissionException
protected String createNewFolderName()
public void addEventListener(SchedulerEventListenerExtended sel) throws NotConnectedException, PermissionException
public void removeEventListener(SchedulerEventListenerExtended sel)
public void schedulerStateUpdatedEvent(SchedulerEvent eventType)
SchedulerEventListener
schedulerStateUpdatedEvent
in interface SchedulerEventListener
eventType
- the type of the event received.public void jobSubmittedEvent(JobState job)
SchedulerEventListener
jobSubmittedEvent
in interface SchedulerEventListener
job
- the newly submitted job.public void jobStateUpdatedEvent(NotificationData<JobInfo> notification)
SchedulerEventListener
JobState.update(org.ow2.proactive.scheduler.common.job.JobInfo)
method to update the content of your job.jobStateUpdatedEvent
in interface SchedulerEventListener
notification
- the data composed of the type of the event and the information that have change in the job.public void jobUpdatedFullDataEvent(JobState job)
SchedulerEventListener
jobUpdatedFullDataEvent
in interface SchedulerEventListener
job
- the updated job.public void taskStateUpdatedEvent(NotificationData<TaskInfo> notification)
SchedulerEventListener
JobState.update(org.ow2.proactive.scheduler.common.task.TaskInfo)
method to update the content of the designated task inside your job.taskStateUpdatedEvent
in interface SchedulerEventListener
notification
- the data composed of the type of the event and the information that have change in the task.public void usersUpdatedEvent(NotificationData<UserIdentification> notification)
SchedulerEventListener
usersUpdatedEvent
in interface SchedulerEventListener
notification
- the data composed of the type of the event and the data linked to the change.protected void updateJob(NotificationData<?> notification)
notification
- protected void updateTask(NotificationData<TaskInfo> notification)
notification
- protected void removeAwaitedTask(String jobId, String taskName)
jobId
- taskName
- protected abstract Scheduler _getScheduler()
/!\ This method must not be exposed remotely since remote calls to the proxy that is returned will fail with permission failures.
public abstract void registerAsListener() throws NotConnectedException, PermissionException
public abstract boolean uploadInputfiles(TaskFlowJob job, String localInputFolderPath) throws Exception
job
- job to push data forlocalInputFolderPath
- utFolderPath local input folderNotConnectedException
PermissionException
Exception
protected abstract void downloadTaskOutputFiles(AwaitedJob awaitedjob, String jobId, String t_name, String localFolder) throws Exception
jobId
- job to pull data fort_name
- name of the tasklocalFolder
- local output folder, if not null, it overrides the folder specified as output folder for the jobException
public abstract JobId submit(Job job) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
Scheduler
It will execute the tasks of the jobs as soon as resources are available. The job will be considered as finished once every tasks have finished (error or success). Thus, user could get the job result according to the precious result.
It is possible to get a listener on the scheduler. (see
Scheduler.addEventListener(SchedulerEventListener, boolean, SchedulerEvent...)
for more details)
submit
in interface Scheduler
job
- the new job to submit.NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular method.SubmissionClosedException
- if the submit action could not be performed.JobCreationException
- if Their was a problem while creation the jobpublic JobResult getJobResult(String jobId) throws NotConnectedException, PermissionException, UnknownJobException
Scheduler
JobId.value()
method.getJobResult
in interface Scheduler
jobId
- the job on which the result will be sendNotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular job.UnknownJobException
- if the job does not exist.public abstract JobState getJobState(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.getJobState
in interface Scheduler
jobId
- the job on which to get the state.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public SchedulerStatus getStatus() throws NotConnectedException, PermissionException
Scheduler
getStatus
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular method.public JobState getJobState(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
getJobState
in interface Scheduler
jobId
- the job on which to get the state.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public SchedulerState getState() throws NotConnectedException, PermissionException
Scheduler
If a PermissionException is thrown, try using Scheduler.getState(boolean)
method with argument true
.
getState
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular method.public SchedulerState getState(boolean myJobsOnly) throws NotConnectedException, PermissionException
Scheduler
getState
in interface Scheduler
myJobsOnly
- true to get only my jobs, false to get any.NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular method.public void addEventListener(SchedulerEventListener sel, boolean myEventsOnly, SchedulerEvent... events) throws NotConnectedException, PermissionException
Scheduler
This method behaves exactly the same as a call to addEventListener(sel, myEventsOnly, false, events); but return nothing
addEventListener
in interface Scheduler
sel
- a SchedulerEventListener on which the scheduler will talk.myEventsOnly
- a boolean that indicates if you want to receive every event or
just the one concerning your jobs. This won't affect the
scheduler state event that will be sent anyway.events
- An array of events that you want to receive from the
scheduler.NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular job.public SchedulerState addEventListener(SchedulerEventListener sel, boolean myEventsOnly, boolean getCurrentState, SchedulerEvent... events) throws NotConnectedException, PermissionException
Scheduler
You may use this method once by remote or active object.
Every call to this method will remove your previous listening settings.
If you want to get 2 type of events, add the 2 events type you want at
the end of this method. If no type is specified, all of them will be
sent.
If you want to received the events concerning your job only, just set the 'myEventsOnly' parameter to true. otherwise, you will received events coming from any user.
addEventListener
in interface Scheduler
sel
- a SchedulerEventListener on which the scheduler will talk.myEventsOnly
- a boolean that indicates if you want to receive every events
or just those concerning your jobs. This won't affect the
scheduler state event that will be sent anyway.getCurrentState
- if false, this method returns null, if true, it returns the
Scheduler current state.events
- An array of events that you want to receive from the
scheduler.NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular job.public void removeEventListener() throws NotConnectedException, PermissionException
Scheduler
removeEventListener
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular method.public abstract TaskResult getTaskResult(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
JobId.value()
method.getTaskResult
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public TaskResult getTaskResult(JobId jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
getTaskResult
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public TaskResult getTaskResultFromIncarnation(String jobId, String taskName, int inc) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
JobId.value()
method. A user can only get HIS
result back. The incarnation argument represents the task result to get.
If the task has failed 3 times and then has worked, then 0 represents the
last result, 1 the previous, ..., and 3 represents the result of the
first execution.
If the job does not exist, a schedulerException is sent with the proper message. So, if you have the right to get the task result that is in the job represented by the given jobId and if the job and task name exist, so you will receive the result. In any other cases a schedulerException will be thrown.
getTaskResultFromIncarnation
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.inc
- id of incarnation (0 is the last one, 1 the previous, and so
on...)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public boolean removeJob(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
The jobId is given as a string. It's in fact the string returned by the
JobId.value()
method.
A user can only remove HIS job.
If the job does not exist, a schedulerException is sent with the proper
message.
removeJob
in interface Scheduler
jobId
- the job to be removed.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public void listenJobLogs(String jobId, AppenderProvider appenderProvider) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.listenJobLogs
in interface Scheduler
jobId
- the id of the job to listen to.appenderProvider
- a provider for an appender that must be connected on a log
server on the caller side (see LogForwardingService
)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean killJob(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.killJob
in interface Scheduler
jobId
- the job to kill.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean killTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
true
.SchedulerException
will be thrown.killTask
in interface Scheduler
jobId
- the job containing the task to be killed.taskName
- the name of the task to kill.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean restartTask(String jobId, String taskName, int restartDelay) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
true
.SchedulerException
will be thrown.
After this call, the following situations can occur :
restartTask
in interface Scheduler
jobId
- the job containing the task to be restarted.taskName
- the name of the task to restart.restartDelay
- the delay between the task termination and it's eligibility to
be re-scheduled (in sec)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean preemptTask(String jobId, String taskName, int restartDelay) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
true
.SchedulerException
will be thrown.preemptTask
in interface Scheduler
jobId
- the job containing the task to be stopped.taskName
- the name of the task to stop.restartDelay
- the delay between the task termination and it's eligibility to
be re-scheduled (in sec)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean pauseJob(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.pauseJob
in interface Scheduler
jobId
- the job to pause.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean resumeJob(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.resumeJob
in interface Scheduler
jobId
- the job to resume.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public void changeJobPriority(String jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException
Scheduler
JobId.value()
method.changeJobPriority
in interface Scheduler
jobId
- the job on which to change the priority.priority
- The new priority to apply to the job.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.JobAlreadyFinishedException
- if you want to change the priority on a finished job.public abstract List<String> getUserSpaceURIs() throws NotConnectedException, PermissionException
Scheduler
getUserSpaceURIs
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
public abstract List<String> getGlobalSpaceURIs() throws NotConnectedException, PermissionException
Scheduler
getGlobalSpaceURIs
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
public JobResult getJobResult(JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException
Scheduler
getJobResult
in interface Scheduler
jobId
- the job on which the result will be sendNotConnectedException
- if you are not authenticated.PermissionException
- if you can't access to this particular job.UnknownJobException
- if the job does not exist.public TaskResult getTaskResultFromIncarnation(JobId jobId, String taskName, int inc) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
A user can only get HIS result back.
The incarnation argument represents the task result to get. If the task has failed 3 times and then has worked, then 0 represents the last result, 1 the previous, ..., and 3 represents the result of the first execution.
If the job does not exist, a schedulerException is sent with the proper message.
So, if you have the right to get the task result that is in the job represented by the given jobId and if the job and task name exist, so you will receive the result. In any other cases a schedulerException will be thrown.
getTaskResultFromIncarnation
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.inc
- id of incarnation (0 is the last one, 1 the previous, and so
on...)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public List<TaskResult> getTaskResultAllIncarnations(JobId jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
This method returns a list of task result attempts. If the task has failed 3 times and then has worked, then the list will contain a list of 4 task results. 0 represents the first failed result attempt, 1 the next one, ..., and 3 represents the result of the last execution. In that sense the id order is reversed comparing to individual calls to getTaskResultFromIncarnation
getTaskResultAllIncarnations
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public List<TaskResult> getTaskResultAllIncarnations(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
This method returns a list of task result attempts. If the task has failed 3 times and then has worked, then the list will contain a list of 4 task results. 0 represents the first failed result attempt, 1 the next one, ..., and 3 represents the result of the last execution. In that sense the id order is reversed comparing to individual calls to
getTaskResultAllIncarnations
in interface Scheduler
jobId
- the job in which the task result is.taskName
- the name of the task in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job.public boolean killTask(JobId jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
If the job does not exist, an UnknownJobException is sent with the proper message.
So, if you have the right to kill this task and if the job and task name
exist and is running, the task will be killed and this method will return
true
. In any other cases a SchedulerException
will
be thrown.
killTask
in interface Scheduler
jobId
- the job containing the task to be killed.taskName
- the name of the task to kill.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean restartTask(JobId jobId, String taskName, int restartDelay) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
If the job does not exist, an UnknownJobException is sent with the proper
message. So, if you have the right to restart this task and if the job
and task name exist and is running, the task will be restarted and this
method will return true
.
The given delay is the delay between the task termination and it's
eligibility to be re-scheduled. In any other cases a
SchedulerException
will be thrown.
After this call, the following situations can occur :
restartTask
in interface Scheduler
jobId
- the job containing the task to be restarted.taskName
- the name of the task to restart.restartDelay
- the delay between the task termination and it's eligibility to
be re-scheduled (in sec)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean preemptTask(JobId jobId, String taskName, int restartDelay) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
If the job does not exist, an UnknownJobException is sent with the proper message.
So, if you have the right to stop this task and if the job and task name
exist and is running, the task will be stopped and restarted later and
this method will return true
.
The given delay is the delay between the task termination and it's
eligibility to be re-scheduled. In any other cases a
SchedulerException
will be thrown.
preemptTask
in interface Scheduler
jobId
- the job containing the task to be stopped.taskName
- the name of the task to stop.restartDelay
- the delay between the task termination and it's eligibility to
be re-scheduled (in sec)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.UnknownTaskException
- if this task does not exist in the job.PermissionException
- if you can't access to this particular job and task.public boolean removeJob(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
removeJob
in interface Scheduler
jobId
- the job to be removed.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public void listenJobLogs(JobId jobId, AppenderProvider appenderProvider) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
A user can only listen to HIS jobs.
listenJobLogs
in interface Scheduler
jobId
- the id of the job to listen to.appenderProvider
- a provider for an appender that must be connected on a log
server on the caller side (see LogForwardingService
)NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean killJob(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
killJob
in interface Scheduler
jobId
- the job to kill.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean pauseJob(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
pauseJob
in interface Scheduler
jobId
- the job to pause.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public boolean resumeJob(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
resumeJob
in interface Scheduler
jobId
- the job to resume.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public void changeJobPriority(JobId jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException
Scheduler
changeJobPriority
in interface Scheduler
jobId
- the job on which to change the priority.priority
- The new priority to apply to the job.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.JobAlreadyFinishedException
- if you want to change the priority on a finished job.public boolean changePolicy(String policyClassName) throws NotConnectedException, PermissionException
Scheduler
This method will immediately change the policy and so the whole scheduling process.
changePolicy
in interface Scheduler
policyClassName
- the new policy full class name.NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean start() throws NotConnectedException, PermissionException
Scheduler
start
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean stop() throws NotConnectedException, PermissionException
Scheduler
stop
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean pause() throws NotConnectedException, PermissionException
Scheduler
pause
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean freeze() throws NotConnectedException, PermissionException
Scheduler
freeze
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean resume() throws NotConnectedException, PermissionException
Scheduler
resume
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean shutdown() throws NotConnectedException, PermissionException
Scheduler
shutdown
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean kill() throws NotConnectedException, PermissionException
Scheduler
kill
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public boolean linkResourceManager(String rmURL) throws NotConnectedException, PermissionException
Scheduler
Can be used if the resource manager has crashed.
linkResourceManager
in interface Scheduler
rmURL
- the URL of the new Resource Manager to link to the scheduler.
Example: //host/RM_node_name
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public String getCurrentPolicy() throws NotConnectedException, PermissionException
Scheduler
getCurrentPolicy
in interface Scheduler
NotConnectedException
PermissionException
public Map getJobsToSchedule() throws NotConnectedException, PermissionException
Scheduler
getJobsToSchedule
in interface Scheduler
NotConnectedException
PermissionException
public List<TaskDescriptor> getTasksToSchedule() throws NotConnectedException, PermissionException
Scheduler
getTasksToSchedule
in interface Scheduler
NotConnectedException
PermissionException
public boolean reloadPolicyConfiguration() throws NotConnectedException, PermissionException
Scheduler
The default behavior reload the configuration file and update the
properties available in policy.
This will cause the Policy#reloadConfig()
method to be called.
This last method can be overridden in the policy to perform a custom
behavior on reload.
reloadPolicyConfiguration
in interface Scheduler
NotConnectedException
- if you are not authenticated.PermissionException
- if you have not enough permission to access this method.public abstract void addEventListener(SchedulerEventListenerExtended listener, boolean myEventsOnly, SchedulerEvent[] events) throws NotConnectedException, PermissionException
protected abstract void removeJobIO(Job job, String pushURL, String pullURL, String newFolderName)
protected abstract void createFolder(String fUri) throws NotConnectedException, PermissionException
public List<JobUsage> getMyAccountUsage(Date startDate, Date endDate) throws NotConnectedException, PermissionException
SchedulerUsage
Only the jobs finished between the start date and the end date will be returned:
i.e startDate <= job.finishedTime <= endDate
.
getMyAccountUsage
in interface SchedulerUsage
startDate
- must not be null, inclusiveendDate
- must not be null, inclusiveJobUsage
objects where job finished times are between start date and end dateNotConnectedException
- if the caller is not connectedPermissionException
- if the caller hasn't the permission to call this methodpublic List<JobUsage> getAccountUsage(String user, Date startDate, Date endDate) throws NotConnectedException, PermissionException
SchedulerUsage
Only the jobs finished between the start date and the end date will be returned:
i.e startDate <= job.finishedTime <= endDate
.
If user is the same as the caller, then it will fallback to to SchedulerUsage.getMyAccountUsage(Date, Date)
.
getAccountUsage
in interface SchedulerUsage
user
- must match a username as defined in the Scheduler's usersstartDate
- must not be null, inclusiveendDate
- must not be null, inclusiveJobUsage
objects where job finished times are between start date and end dateNotConnectedException
- if the caller is not connectedPermissionException
- if the caller hasn't the permission to call this methodpublic void putThirdPartyCredential(String key, String value) throws NotConnectedException, PermissionException, KeyException
ThirdPartyCredentials
putThirdPartyCredential
in interface ThirdPartyCredentials
key
- the third-party credential key to storevalue
- the third-party credential value to store, it will be encryptedNotConnectedException
- if you are not authenticated.PermissionException
- if you can't access this particular method.KeyException
- if encryption of value failspublic Set<String> thirdPartyCredentialsKeySet() throws NotConnectedException, PermissionException
thirdPartyCredentialsKeySet
in interface ThirdPartyCredentials
NotConnectedException
- if you are not authenticated.PermissionException
- if you can't access this particular method.public void removeThirdPartyCredential(String key) throws NotConnectedException, PermissionException
removeThirdPartyCredential
in interface ThirdPartyCredentials
key
- the third-party credential key to removeNotConnectedException
- if you are not authenticated.PermissionException
- if you can't access this particular method.public List<TaskResult> getTaskResultsByTag(JobId jobId, String taskTag) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
getTaskResultsByTag
in interface Scheduler
jobId
- the job in which the task result is.taskTag
- the tag used to filter the tasks in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public List<TaskResult> getTaskResultsByTag(String jobId, String taskTag) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.getTaskResultsByTag
in interface Scheduler
jobId
- the job in which the task result is.taskTag
- the tag used to filter the tasks in which the result is.NotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.