Package com.datarobot.impl
Class StatusTask<T>
- java.lang.Object
-
- com.datarobot.impl.StatusTask<T>
-
public class StatusTask<T> extends java.lang.ObjectA reference to aTaskon the DataRobot server. Client code that uses the DataRobot AI API package generally should not construct these objects directly, they should be instantiated by AI API Client methods. This object may be out of sync with the DataRobot sever, for example, if multiple processes or users have permission to modify or delete it on the server.
-
-
Constructor Summary
Constructors Constructor Description StatusTask(IDataRobotAIClient client, ILocationResponse hasLocation, IDoGetCallback<T> callback)internal
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetError()Returns theerrorof thisStatusTaskAction<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse>getHttpMessageTransformer()internaljava.lang.StringgetMessage()Returns the currentmessageof thisStatusTaskTgetResult()Wait until the operation completes, and return its outputTgetResult(int timeout)Wait until the operation completes, and return its outputjava.util.concurrent.Future<T>getResultAsync()Start the process of returning the output of thisStatusTaskonce the operation completes.java.util.concurrent.Future<T>getResultAsync(int timeout)Start the process of returning the output of thisStatusTaskonce the operation completes.java.lang.StringgetStatus()Returns the currentstatusof thisStatusTaskbooleangetSuccess()Check if a task is successfulbooleanisSuccessful()Check if a task is successfulvoidsetHttpMessageTransformer(Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> httpMessageTransformer)internalbooleantimeOut()Indication if thisStatusTasktimed out before completion.java.lang.StringtoString()
-
-
-
Constructor Detail
-
StatusTask
public StatusTask(IDataRobotAIClient client, ILocationResponse hasLocation, IDoGetCallback<T> callback)
internal
-
-
Method Detail
-
isSuccessful
public boolean isSuccessful()
Check if a task is successful- Returns:
- Boolean
Truewhen the operation was successful,Falsewhen the API indicated there was an error with the operation, or if the operation is not yet complete
-
getSuccess
public boolean getSuccess()
Check if a task is successful- Returns:
- Boolean
Truewhen the operation was successful,Falsewhen the API indicated there was an error with the operation, or if the operation is not yet complete
-
getError
public java.lang.String getError()
Returns theerrorof thisStatusTask- Returns:
- the error that occurred
-
getStatus
public java.lang.String getStatus()
Returns the currentstatusof thisStatusTask- Returns:
- the current task status
-
getMessage
public java.lang.String getMessage()
Returns the currentmessageof thisStatusTask- Returns:
- the current message
-
timeOut
public boolean timeOut()
Indication if thisStatusTasktimed out before completion.- Returns:
- Boolean
Trueif the operation took longer than the timeout given togetResultor if the default timeout was exceeded
-
getHttpMessageTransformer
public Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> getHttpMessageTransformer()
internal
-
setHttpMessageTransformer
public void setHttpMessageTransformer(Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> httpMessageTransformer)
internal
-
getResultAsync
public java.util.concurrent.Future<T> getResultAsync(int timeout)
Start the process of returning the output of thisStatusTaskonce the operation completes. UsegetResult()on the return of this object to retrieve the result.- Parameters:
timeout- the time in seconds to wait for thisStatusTaskto complete- Returns:
- the result of this
FutureStatusTask
-
getResultAsync
public java.util.concurrent.Future<T> getResultAsync()
Start the process of returning the output of thisStatusTaskonce the operation completes. UsegetResult()on the return of this object to retrieve the result.- Returns:
- the result of this
FutureStatusTask
-
getResult
public T getResult() throws ClientException, java.lang.InterruptedException
Wait until the operation completes, and return its output- Returns:
- the result of this
StatusTask - Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.java.lang.InterruptedException- when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
-
getResult
public T getResult(int timeout) throws ClientException, java.lang.InterruptedException
Wait until the operation completes, and return its output- Parameters:
timeout- the time in seconds to wait for thisStatusTaskto complete- Returns:
- the result of this
StatusTask - Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.java.lang.InterruptedException- when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-