public class RestSmartProxyImpl extends AbstractSmartProxy<RestJobTrackerImpl> implements ISchedulerClient, SchedulerEventListener, DisconnectionAwareSchedulerEventListener
Any instance of this class must be initialized by calling the ISchedulerClient.init(ConnectionInfo)
method before executing any subsequent method. Not
respecting this rule may lead to an NPE or an unexpected behaviour.
configuredEvents, connectionInfo, eventListeners, GENERIC_INFO_INPUT_FOLDER_PROPERTY_NAME, GENERIC_INFO_OUTPUT_FOLDER_PROPERTY_NAME, GENERIC_INFO_PULL_URL_PROPERTY_NAME, GENERIC_INFO_PUSH_URL_PROPERTY_NAME, jobTracker, MAX_NB_OF_DATA_TRANSFER_THREADS, PROXY_SCHED_EVENTS, terminated, terminating, threadPool
Constructor and Description |
---|
RestSmartProxyImpl() |
Modifier and Type | Method and Description |
---|---|
protected ISchedulerClient |
_getScheduler()
Returns a proxy instance to the Scheduler.
|
void |
addEventListener(SchedulerEventListenerExtended listener,
boolean myEventsOnly,
SchedulerEvent... events) |
boolean |
changeStartAt(JobId jobId,
String startAt)
Change the START_AT generic information at job level and reset the
scheduledAt at task level
|
boolean |
checkJobPermissionMethod(String sessionId,
String jobId,
String method)
Check if the user has the permission to execute the method passed as argument
|
protected void |
createFolder(String fUri) |
boolean |
deleteFile(String space,
String pathname)
Deletes the specified file from the server.
|
void |
disconnect()
Disconnect from the scheduler
|
protected void |
downloadTaskOutputFiles(AwaitedJob awaitedjob,
String jobId,
String taskName,
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 |
finishInErrorTask(String jobId,
String taskName) |
ConnectionInfo |
getConnectionInfo()
Returns the connection info, if initialized previously
|
String |
getCurrentPolicy()
Return the name of the current Policy
|
String |
getCurrentUser()
Returns the user currently connected
|
UserData |
getCurrentUserData()
Returns the user data object associated with the user currently connected
|
List<String> |
getGlobalSpaceURIs()
Returns the GLOBAL DataSpace URI available to all users
|
String |
getJobContent(JobId jobId) |
JobInfo |
getJobInfo(String jobId)
Retrieve a job info by it id.
|
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)
|
Map<Object,Object> |
getPortalConfiguration() |
Map<String,Object> |
getSchedulerProperties()
Returns the scheduler properties associated with the user currently connected
|
String |
getSession()
Retrieves the current session identifier, or null if the session was not initialized yet.
|
Page<TaskId> |
getTaskIds(String taskTag,
long from,
long to,
boolean mytasks,
boolean running,
boolean pending,
boolean finished,
int offset,
int limit)
Retrieve a tasks names list from the scheduler.
|
TaskStatesPage |
getTaskPaginated(String jobId,
int offset,
int limit)
Return the page of tasks of the given job.
|
TaskResult |
getTaskResult(String jobId,
String taskName)
Get the result for the given task name in the given jobId.
|
Page<TaskState> |
getTaskStates(String taskTag,
long from,
long to,
boolean mytasks,
boolean running,
boolean pending,
boolean finished,
int offset,
int limit,
SortSpecifierContainer sortParams)
Retrieve a taskstates list from the scheduler.
|
List<TaskDescriptor> |
getTasksToSchedule()
get task descriptor list with eligible tasks (running)
|
List<String> |
getUserSpaceURIs()
Returns the USER DataSpace URIs associated with the current user
|
void |
init(ConnectionInfo connectionInfo)
Connects to the scheduler
|
boolean |
isJobFinished(JobId jobId)
Returns true, if the scheduler has finished the execution of the
specified job.
|
boolean |
isJobFinished(String jobId)
Returns true, if the scheduler has terminated the execution of
the specified job.
|
boolean |
isTaskFinished(String jobId,
String taskName)
Returns true, if the scheduler has finished the execution of the
task.
|
void |
notifyDisconnection()
notify the socket disconnection
|
void |
pullFile(String space,
String pathname,
String outputFile)
Retrieves the specified file from the server.
|
boolean |
pushFile(String spacename,
String pathname,
String filename,
String file)
Transfers the specified file from the local file system to the specified
dataspace at the server
|
void |
registerAsListener() |
protected void |
removeJobIO(Job job,
String pushURL,
String pullURL,
String newFolderName) |
boolean |
restartAllInErrorTasks(String jobId)
Restart all in error tasks in the job represented by jobId.
This method will restart every in error tasks of this job. The jobId is given as a string. |
boolean |
restartInErrorTask(String jobId,
String taskName) |
void |
setSession(String sid)
Sets the session identifier explicitly.
|
JobId |
submit(File job)
Submit a new job to the scheduler.
|
JobId |
submit(File job,
Map<String,String> variables)
Submit a new job to the scheduler with provided variables.
|
JobId |
submit(File job,
Map<String,String> variables,
Map<String,String> genericInfos)
Submit a new job to the scheduler with provided variables.
|
JobId |
submit(Job job)
Submit a new job to the scheduler.
|
JobId |
submit(Map<String,String> genericInfos,
URL job,
Map<String,String> variables)
Submit a new job to the scheduler with provided variables.
|
JobId |
submit(URL job)
Submit a new job to the scheduler.
|
JobId |
submit(URL job,
Map<String,String> variables)
Submit a new job to the scheduler with provided variables.
|
JobId |
submit(URL job,
Map<String,String> variables,
Map<String,String> headerParams)
Submit a new job to the scheduler with provided variables.
|
JobId |
submit(URL job,
Map<String,String> variables,
Map<String,String> genericInfos,
Map<String,String> headerParams)
Submit a new job to the scheduler with provided variables.
|
JobId |
submitFromCatalog(String catalogRestURL,
String calledWorkflow)
Submit a new job to the scheduler from the catalogRestURL without provided variables.
|
JobId |
submitFromCatalog(String catalogRestURL,
String calledWorkflow,
Map<String,String> variables)
Submit a new job to the scheduler from the catalogRestURL with provided variables.
|
JobId |
submitFromCatalog(String catalogRestURL,
String calledWorkflow,
Map<String,String> variables,
Map<String,String> genericInfo)
Submit a new job to the scheduler from the catalogRestURL with provided variables ang generic information.
|
JobId |
submitFromCatalog(String catalogRestURL,
String bucketName,
String workflowName)
Submit a new job to the scheduler from the catalogRestURL without variables.
|
JobId |
submitFromCatalog(String catalogRestURL,
String bucketName,
String workflowName,
Map<String,String> variables)
Submit a new job to the scheduler from the catalogRestURL with provided variables.
|
JobId |
submitFromCatalog(String catalogRestURL,
String bucketName,
String workflowName,
Map<String,String> variables,
Map<String,String> genericInfo)
Submit a new job to the scheduler from the catalogRestURL with provided variables.
|
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.
|
List<JobResult> |
waitForAllJobs(List<String> jobIds,
long timeout)
Causes the current thread to wait until the execution of all specified
jobs has finished or the elapse of specified wait time.
|
List<Map.Entry<String,TaskResult>> |
waitForAllTasks(String jobId,
List<String> taskNames,
long timeout)
Causes the current thread to wait until all the executions of specified
tasks finish or the elapse of specified amount of time.
|
Map.Entry<String,JobResult> |
waitForAnyJob(List<String> jobIds,
long timeout)
Causes the current thread to wait until the execution of any job finishes
or the elapse of the specified wait time.
|
Map.Entry<String,TaskResult> |
waitForAnyTask(String jobId,
List<String> taskNames,
long timeout)
Causes the current thread to wait until any of the specified tasks
finishes or the elapse of specified amount of time.
|
JobResult |
waitForJob(JobId jobId,
long timeout)
Causes the current thread to wait until the scheduler has finished the
execution of the specified job or the specified amount of time has
elapsed.
|
JobResult |
waitForJob(String jobId,
long timeout)
Causes the current thread to wait until the scheduler has finished the
execution of the specified job or the specified amount of time has
elapsed.
|
TaskResult |
waitForTask(String jobId,
String taskName,
long timeout)
Causes the current thread to wait until the scheduler has finished
executing the specified task or the elapse of specified elapse time.
|
addEventListener, addEventListener, addEventListener, changeJobPriority, changeJobPriority, changePolicy, checkInitialized, cleanDatabase, configureEvents, createNewFolderName, freeze, getAccountUsage, getJobResult, getJobResult, getJobs, getJobServerLogs, getJobsInfoList, getJobState, getMyAccountUsage, getState, getState, getStatus, getTaskResult, getTaskResultAllIncarnations, getTaskResultAllIncarnations, getTaskResultFromIncarnation, getTaskResultFromIncarnation, getTaskResultsByTag, getTaskResultsByTag, getTaskServerLogs, getTaskServerLogsByTag, getUsers, getUsersWithJobs, isConnected, jobStateUpdatedEvent, jobSubmittedEvent, jobUpdatedFullDataEvent, kill, killJob, killJob, killTask, killTask, linkResourceManager, listenJobLogs, listenJobLogs, pause, pauseJob, pauseJob, preemptTask, preemptTask, prepareJobInput, prepareJobOutput, pullData, putThirdPartyCredential, reconnect, reinitializeState, reloadPolicyConfiguration, removeAwaitedTask, removeEventListener, removeEventListener, removeJob, removeJob, removeThirdPartyCredential, renewSession, restartTask, restartTask, resume, resumeJob, resumeJob, schedulerStateUpdatedEvent, setInitialized, setSessionName, shutdown, start, stop, submit, submit, syncAwaitedJobs, taskStateUpdatedEvent, terminate, thirdPartyCredentialsKeySet, updateJob, updateTask, usersUpdatedEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addEventListener, addEventListener, changeJobPriority, changeJobPriority, changePolicy, freeze, getJobResult, getJobResult, getJobs, getJobServerLogs, getJobsInfoList, getJobState, getState, getState, getStatus, getTaskResult, getTaskResultAllIncarnations, getTaskResultAllIncarnations, getTaskResultFromIncarnation, getTaskResultFromIncarnation, getTaskResultsByTag, getTaskResultsByTag, getTaskServerLogs, getTaskServerLogsByTag, getUsers, getUsersWithJobs, isConnected, kill, killJob, killJob, killTask, killTask, linkResourceManager, listenJobLogs, listenJobLogs, pause, pauseJob, pauseJob, preemptTask, preemptTask, reloadPolicyConfiguration, removeEventListener, removeJob, removeJob, renewSession, restartTask, restartTask, resume, resumeJob, resumeJob, shutdown, start, stop
getAccountUsage, getMyAccountUsage
putThirdPartyCredential, removeThirdPartyCredential, thirdPartyCredentialsKeySet
jobStateUpdatedEvent, jobSubmittedEvent, jobUpdatedFullDataEvent, schedulerStateUpdatedEvent, taskStateUpdatedEvent, usersUpdatedEvent
public void init(ConnectionInfo connectionInfo)
AbstractSmartProxy
init
in interface ISchedulerClient
init
in class AbstractSmartProxy<RestJobTrackerImpl>
connectionInfo
- various info about the connection attemptpublic ConnectionInfo getConnectionInfo()
ISchedulerClient
getConnectionInfo
in interface ISchedulerClient
public void disconnect() throws PermissionException
AbstractSmartProxy
disconnect
in interface Scheduler
disconnect
in class AbstractSmartProxy<RestJobTrackerImpl>
PermissionException
- if you can't access to this particular method.public String getCurrentPolicy() throws NotConnectedException, PermissionException
Scheduler
getCurrentPolicy
in interface Scheduler
getCurrentPolicy
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
public Map getJobsToSchedule() throws NotConnectedException, PermissionException
Scheduler
getJobsToSchedule
in interface Scheduler
getJobsToSchedule
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
public List<TaskDescriptor> getTasksToSchedule() throws NotConnectedException, PermissionException
Scheduler
getTasksToSchedule
in interface Scheduler
getTasksToSchedule
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
protected ISchedulerClient _getScheduler()
AbstractSmartProxy
/!\ This method must not be exposed remotely since remote calls to the proxy that is returned will fail with permission failures.
_getScheduler
in class AbstractSmartProxy<RestJobTrackerImpl>
protected void createFolder(String fUri) throws NotConnectedException, PermissionException
createFolder
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
protected void removeJobIO(Job job, String pushURL, String pullURL, String newFolderName)
removeJobIO
in class AbstractSmartProxy<RestJobTrackerImpl>
public 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
submit
in class AbstractSmartProxy<RestJobTrackerImpl>
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 JobId submit(File job) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a local FileNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(File job, Map<String,String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a local Filevariables
- job variables to use during the job executionNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(File job, Map<String,String> variables, Map<String,String> genericInfos) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a local Filevariables
- job variables to use during the job executiongenericInfos
- map with generic informationsNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(URL job) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a urlNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(URL job, Map<String,String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a urlvariables
- job variables to use during the job executionNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(URL job, Map<String,String> variables, Map<String,String> headerParams) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a urlvariables
- job variables to use during the job executionheaderParams
- map with request header parametersNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(URL job, Map<String,String> variables, Map<String,String> genericInfos, Map<String,String> headerParams) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
job
- a job provided as a urlvariables
- job variables to use during the job executiongenericInfos
- map with generic informationsheaderParams
- map with request header parametersNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submit(Map<String,String> genericInfos, URL job, Map<String,String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submit
in interface ISchedulerClient
genericInfos
- map with generic informationsjob
- a job provided as a urlvariables
- job variables to use during the job executionNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String bucketName, String workflowName) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
NotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String bucketName, String workflowName, Map<String,String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
NotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String bucketName, String workflowName, Map<String,String> variables, Map<String,String> genericInfo) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
genericInfo
- map with generic informationNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String calledWorkflow) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
NotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String calledWorkflow, Map<String,String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
NotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobId submitFromCatalog(String catalogRestURL, String calledWorkflow, Map<String,String> variables, Map<String,String> genericInfo) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException
ISchedulerClient
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.
submitFromCatalog
in interface ISchedulerClient
genericInfo
- map with generic informationNotConnectedException
PermissionException
SubmissionClosedException
JobCreationException
public JobState getJobState(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.getJobState
in interface Scheduler
getJobState
in class AbstractSmartProxy<RestJobTrackerImpl>
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 TaskResult getTaskResult(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
Scheduler
JobId.value()
method.getTaskResult
in interface Scheduler
getTaskResult
in class AbstractSmartProxy<RestJobTrackerImpl>
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 finishInErrorTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
finishInErrorTask
in interface Scheduler
NotConnectedException
UnknownJobException
UnknownTaskException
PermissionException
public boolean restartInErrorTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException
restartInErrorTask
in interface Scheduler
NotConnectedException
UnknownJobException
UnknownTaskException
PermissionException
public boolean restartAllInErrorTasks(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
JobId.value()
method.restartAllInErrorTasks
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 List<String> getGlobalSpaceURIs() throws NotConnectedException, PermissionException
Scheduler
getGlobalSpaceURIs
in interface Scheduler
getGlobalSpaceURIs
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
- if you are not authenticated.PermissionException
public List<String> getUserSpaceURIs() throws NotConnectedException, PermissionException
Scheduler
getUserSpaceURIs
in interface Scheduler
getUserSpaceURIs
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
- if you are not authenticated.PermissionException
public void addEventListener(SchedulerEventListenerExtended listener, boolean myEventsOnly, SchedulerEvent... events) throws NotConnectedException, PermissionException
addEventListener
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
public boolean uploadInputfiles(TaskFlowJob job, String localInputFolderPath) throws NotConnectedException, PermissionException
AbstractSmartProxy
uploadInputfiles
in class AbstractSmartProxy<RestJobTrackerImpl>
job
- job to push data forlocalInputFolderPath
- utFolderPath local input folderNotConnectedException
PermissionException
AbstractSmartProxy.uploadInputfiles(TaskFlowJob, String)
protected void downloadTaskOutputFiles(AwaitedJob awaitedjob, String jobId, String taskName, String localFolder) throws NotConnectedException, PermissionException
AbstractSmartProxy
downloadTaskOutputFiles
in class AbstractSmartProxy<RestJobTrackerImpl>
jobId
- job to pull data fortaskName
- name of the tasklocalFolder
- local output folder, if not null, it overrides the folder specified as output folder for the jobNotConnectedException
PermissionException
public void registerAsListener() throws NotConnectedException, PermissionException
registerAsListener
in class AbstractSmartProxy<RestJobTrackerImpl>
NotConnectedException
PermissionException
public void setSession(String sid)
ISchedulerClient
setSession
in interface ISchedulerClient
sid
- session identifierpublic String getSession()
ISchedulerClient
getSession
in interface ISchedulerClient
public boolean isJobFinished(JobId jobId) throws NotConnectedException, UnknownJobException, PermissionException
ISchedulerClient
isJobFinished
in interface ISchedulerClient
jobId
- the job identifier objectNotConnectedException
- if the client is not logged in or the session has expiredUnknownJobException
- if the job identifier is invalidPermissionException
- if the user does not have permission to view the state of the
specified jobpublic boolean isJobFinished(String jobId) throws NotConnectedException, UnknownJobException, PermissionException
ISchedulerClient
isJobFinished
in interface ISchedulerClient
jobId
- the job identifier stringNotConnectedException
UnknownJobException
PermissionException
ISchedulerClient.isJobFinished(JobId)
public JobResult waitForJob(JobId jobId, long timeout) throws NotConnectedException, UnknownJobException, PermissionException, TimeoutException
ISchedulerClient
If the job execution finishes before the elapse of wait time, the result of the job is returned. Otherwise a timeout exception is thrown.
waitForJob
in interface ISchedulerClient
jobId
- the job identifier objecttimeout
- the maximum amount of time to waitNotConnectedException
- if the client is not logged in or the session has expiredUnknownJobException
- if the job identifier is invalidPermissionException
- if the user does not have permission to view the state of the
specified jobTimeoutException
- if the job execution does not finish before the elapse of
wait timepublic JobResult waitForJob(String jobId, long timeout) throws NotConnectedException, UnknownJobException, PermissionException, TimeoutException
ISchedulerClient
If the job execution finishes before the elapse of wait time, the result of the job is returned. Otherwise a timeout exception is thrown.
waitForJob
in interface ISchedulerClient
jobId
- the job identifier stringNotConnectedException
UnknownJobException
PermissionException
TimeoutException
ISchedulerClient.waitForJob(JobId, long)
public boolean isTaskFinished(String jobId, String taskName) throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException
ISchedulerClient
isTaskFinished
in interface ISchedulerClient
jobId
- the string identifier of the job to which the task is belongtaskName
- the task nameUnknownJobException
- if the job identifier is invalidNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to view the state of the
taskUnknownTaskException
- if the task name is invalidpublic TaskResult waitForTask(String jobId, String taskName, long timeout) throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException, TimeoutException
ISchedulerClient
If the task execution finishes before the elapse of wait time, the result of the task is returned. Otherwise a timeout exception is thrown.
waitForTask
in interface ISchedulerClient
jobId
- the string identifier of the job to which the task is belongtaskName
- the task nameUnknownJobException
- if the job identifier is invalidNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to view the state of
taskUnknownTaskException
- if the task name is invalidTimeoutException
- if the task execution does not finish before the elapse of
wait timepublic List<JobResult> waitForAllJobs(List<String> jobIds, long timeout) throws NotConnectedException, UnknownJobException, PermissionException, TimeoutException
ISchedulerClient
Returns a list of job results, if the execution of all jobs specified finishes before the elapse of the wait time. Otherwise a timeout exception is thrown.
waitForAllJobs
in interface ISchedulerClient
jobIds
- the list of job identifier stingstimeout
- the maximum amount of wait timeNotConnectedException
- if the client is not logged in or the session has expiredUnknownJobException
- if one of jobs specified is invalidPermissionException
- if the user does not have permission to view the state of one
of the specified jobsTimeoutException
- if the execution of all jobs specified does not finish before
the elapse of specified wait timepublic Map.Entry<String,JobResult> waitForAnyJob(List<String> jobIds, long timeout) throws NotConnectedException, UnknownJobException, PermissionException, TimeoutException
ISchedulerClient
Returns the string identifier and result of the finished job, if any of the execution of the jobs finishes before the elapse of wait time. Otherwise a timeout exception is thrown.
waitForAnyJob
in interface ISchedulerClient
jobIds
- the list of job identifier stringstimeout
- the maximum amount of wait timeNotConnectedException
- if the client is not logged in or the session has expiredUnknownJobException
- if only of the job identifiers is invalidPermissionException
- if the user does not have permission to view the job stateTimeoutException
- if none of the executions of jobs finishes before the elapse
of wait timepublic Map.Entry<String,TaskResult> waitForAnyTask(String jobId, List<String> taskNames, long timeout) throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException, TimeoutException
ISchedulerClient
Returns name and the result of a finished task. Otherwise a timeout exception is thrown.
waitForAnyTask
in interface ISchedulerClient
jobId
- the job identifier of the job to which the specified tasks
belongtaskNames
- the names of the taskstimeout
- the maximum amount of wait timeUnknownJobException
- if the job identifier is invalidNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to view the state of the
tasksUnknownTaskException
- if the name of a task is invalidTimeoutException
- if none of the executions of tasks finish before the elapse
of wait timepublic List<Map.Entry<String,TaskResult>> waitForAllTasks(String jobId, List<String> taskNames, long timeout) throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException, TimeoutException
ISchedulerClient
Returns a list of task name and task result pairs, if all the executions of specified tasks finishes before the elapse of wait time. Otherwise a timeout exception is thrown.
waitForAllTasks
in interface ISchedulerClient
jobId
- the identifier of the job to which all the specified tasks
belongtaskNames
- the task namestimeout
- the maximum amount of wait timeUnknownJobException
- if the job identifier is invalidNotConnectedException
- if the client is not logged in or the session has expired.PermissionException
- if the user does not have permission to view the state of the
tasksUnknownTaskException
- if a task name is invalidTimeoutException
- if all the executions of the tasks do not finish before the
elapse of maximum wait timepublic boolean pushFile(String spacename, String pathname, String filename, String file) throws NotConnectedException, PermissionException
ISchedulerClient
pushFile
in interface ISchedulerClient
spacename
- the dataspace namepathname
- the path of the stored file with respect to the dataspacefilename
- the name of the stored file with respect to the dataspacefile
- the local fileNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to upload the file to
the specified dataspacepublic void pullFile(String space, String pathname, String outputFile) throws NotConnectedException, PermissionException
ISchedulerClient
pullFile
in interface ISchedulerClient
space
- the dataspace namepathname
- the pathname of the file with respect the dataspaceoutputFile
- the name of the output fileNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to retrieve the
specified file from the serverpublic boolean deleteFile(String space, String pathname) throws NotConnectedException, PermissionException
ISchedulerClient
deleteFile
in interface ISchedulerClient
space
- the dataspace namepathname
- the pathname of the file with respect to the dataspaceNotConnectedException
- if the client is not logged in or the session has expiredPermissionException
- if the user does not have permission to delete the file from
the serverpublic Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException
Scheduler
getTaskIds
in interface Scheduler
taskTag
- a complete tag to use to filter tasksfrom
- the starting date to fetch tasks from. The format is in Epoch
time.to
- the end date to stop fetching tasks. The format is in Epoch
time.mytasks
- True
will only fetch the user tasks,
False
will fetch everyones.running
- fetch the running tasks.pending
- fetch the pending tasks.finished
- fetch the finished tasks.offset
- the starting task to include in the paginated list.limit
- the last task (not included) before stopping fetching tasks in
the paginated list.NotConnectedException
PermissionException
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException
Scheduler
getTaskStates
in interface Scheduler
taskTag
- a complete tag to use to filter tasksfrom
- the starting date to fetch tasks from. The format is in Epoch
time.to
- the end date to stop fetching tasks. The format is in Epoch
time.mytasks
- True
will only fetch the user tasks,
False
will fetch everyones.running
- fetch the running tasks.pending
- fetch the pending tasks.finished
- fetch the finished tasks.offset
- the starting task to include in the paginated list.limit
- the last task (not included) before stopping fetching tasks in
the paginated list.NotConnectedException
PermissionException
public JobInfo getJobInfo(String jobId) throws UnknownJobException, NotConnectedException, PermissionException
Scheduler
getJobInfo
in interface Scheduler
jobId
- the id of the job we want to fetch info.JobInfo
associated to the given idUnknownJobException
NotConnectedException
PermissionException
public boolean changeStartAt(JobId jobId, String startAt) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
changeStartAt
in interface Scheduler
jobId
- id of the job that needs to be updatedstartAt
- its value should be ISO 8601 compliantNotConnectedException
UnknownJobException
PermissionException
public String getJobContent(JobId jobId) throws UnknownJobException, SubmissionClosedException, JobCreationException, NotConnectedException, PermissionException
getJobContent
in interface Scheduler
jobId
- job id of existing jobUnknownJobException
SubmissionClosedException
JobCreationException
NotConnectedException
PermissionException
public Map<Object,Object> getPortalConfiguration() throws NotConnectedException, PermissionException
getPortalConfiguration
in interface Scheduler
NotConnectedException
PermissionException
public String getCurrentUser() throws NotConnectedException
Scheduler
getCurrentUser
in interface Scheduler
NotConnectedException
public UserData getCurrentUserData() throws NotConnectedException
Scheduler
getCurrentUserData
in interface Scheduler
NotConnectedException
public Map<String,Object> getSchedulerProperties() throws NotConnectedException, PermissionException
Scheduler
getSchedulerProperties
in interface Scheduler
NotConnectedException
PermissionException
public TaskStatesPage getTaskPaginated(String jobId, int offset, int limit) throws NotConnectedException, UnknownJobException, PermissionException
Scheduler
getTaskPaginated
in interface Scheduler
jobId
- the job on which to get the state.offset
- the starting index of the sublist of tasks to getlimit
- the last index (non inclusive) of the sublist of tasks to getNotConnectedException
- if you are not authenticated.UnknownJobException
- if the job does not exist.PermissionException
- if you can't access to this particular job.public void notifyDisconnection()
notifyDisconnection
in interface DisconnectionAwareSchedulerEventListener
public boolean checkJobPermissionMethod(String sessionId, String jobId, String method) throws NotConnectedException, UnknownJobException
Scheduler
checkJobPermissionMethod
in interface Scheduler
NotConnectedException
UnknownJobException