Interface JobService


  • public interface JobService
    An interface that provides all methods needed for the Genie job client implementation.
    Since:
    3.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String JOBS_URL_SUFFIX
      Path to Jobs.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      retrofit2.Call<Job> getJob​(java.lang.String jobId)
      Method to fetch a single job from Genie.
      retrofit2.Call<java.util.List<Application>> getJobApplications​(java.lang.String jobId)
      Method to get the Applications for a job.
      retrofit2.Call<Cluster> getJobCluster​(java.lang.String jobId)
      Method to get the cluster information on which a job is run.
      retrofit2.Call<Command> getJobCommand​(java.lang.String jobId)
      Method to get the command information on which a job is run.
      retrofit2.Call<JobExecution> getJobExecution​(java.lang.String jobId)
      Method to get the execution information for a job.
      retrofit2.Call<JobMetadata> getJobMetadata​(java.lang.String jobId)
      Method to get the metadata information for a job.
      retrofit2.Call<okhttp3.ResponseBody> getJobOutputFile​(java.lang.String jobId, java.lang.String outputFilePath)
      Method to fetch an output file for a job from Genie.
      retrofit2.Call<okhttp3.ResponseBody> getJobOutputFile​(java.lang.String jobId, java.lang.String outputFilePath, java.lang.String range)
      Method to fetch partial output file for a job from Genie.
      retrofit2.Call<JobRequest> getJobRequest​(java.lang.String jobId)
      Method to get the JobRequest for a job.
      retrofit2.Call<com.fasterxml.jackson.databind.JsonNode> getJobs​(java.lang.String id, java.lang.String name, java.lang.String user, java.util.Set<java.lang.String> statuses, java.util.Set<java.lang.String> tags, java.lang.String clusterName, java.lang.String clusterId, java.lang.String commandName, java.lang.String commandId, java.lang.Long minStarted, java.lang.Long maxStarted, java.lang.Long minFinished, java.lang.Long maxFinished, java.lang.String grouping, java.lang.String groupingInstance, java.lang.Integer size, java.lang.String sort, java.lang.Integer page)
      Method to get all jobs from Genie.
      retrofit2.Call<com.fasterxml.jackson.databind.JsonNode> getJobStatus​(java.lang.String jobId)
      Method to get Job status.
      retrofit2.Call<java.lang.Void> killJob​(java.lang.String jobId)
      Method to send a job kill request to Genie.
      retrofit2.Call<java.lang.Void> submitJob​(JobRequest request)
      Method to submit a job to Genie.
      retrofit2.Call<java.lang.Void> submitJobWithAttachments​(JobRequest request, java.util.List<okhttp3.MultipartBody.Part> attachments)
      Submit a job with attachments.
    • Field Detail

      • JOBS_URL_SUFFIX

        static final java.lang.String JOBS_URL_SUFFIX
        Path to Jobs.
        See Also:
        Constant Field Values
    • Method Detail

      • submitJob

        @POST("/api/v3/jobs")
        retrofit2.Call<java.lang.Void> submitJob​(@Body
                                                 JobRequest request)
        Method to submit a job to Genie.
        Parameters:
        request - The request object containing all the
        Returns:
        A callable object.
      • submitJobWithAttachments

        @Multipart
        @POST("/api/v3/jobs")
        retrofit2.Call<java.lang.Void> submitJobWithAttachments​(@Part("request")
                                                                JobRequest request,
                                                                @Part
                                                                java.util.List<okhttp3.MultipartBody.Part> attachments)
        Submit a job with attachments.
        Parameters:
        request - A JobRequest object containing all the details needed to run the job.
        attachments - A list of all the attachment files to be sent to the server.
        Returns:
        A callable object.
      • getJobs

        @GET("/api/v3/jobs")
        retrofit2.Call<com.fasterxml.jackson.databind.JsonNode> getJobs​(@Query("id")
                                                                        java.lang.String id,
                                                                        @Query("name")
                                                                        java.lang.String name,
                                                                        @Query("user")
                                                                        java.lang.String user,
                                                                        @Query("status")
                                                                        java.util.Set<java.lang.String> statuses,
                                                                        @Query("tag")
                                                                        java.util.Set<java.lang.String> tags,
                                                                        @Query("clusterName")
                                                                        java.lang.String clusterName,
                                                                        @Query("clusterId")
                                                                        java.lang.String clusterId,
                                                                        @Query("commandName")
                                                                        java.lang.String commandName,
                                                                        @Query("commandId")
                                                                        java.lang.String commandId,
                                                                        @Query("minStarted")
                                                                        java.lang.Long minStarted,
                                                                        @Query("maxStarted")
                                                                        java.lang.Long maxStarted,
                                                                        @Query("minFinished")
                                                                        java.lang.Long minFinished,
                                                                        @Query("maxFinished")
                                                                        java.lang.Long maxFinished,
                                                                        @Query("grouping")
                                                                        java.lang.String grouping,
                                                                        @Query("groupingInstance")
                                                                        java.lang.String groupingInstance,
                                                                        @Query("size")
                                                                        java.lang.Integer size,
                                                                        @Query("sort")
                                                                        java.lang.String sort,
                                                                        @Query("page")
                                                                        java.lang.Integer page)
        Method to get all jobs from Genie.
        Parameters:
        id - id for job
        name - name of job (can be a SQL-style pattern such as HIVE%)
        user - user who submitted job
        statuses - statuses of jobs to find
        tags - tags for the job
        clusterName - the name of the cluster
        clusterId - the id of the cluster
        commandName - the name of the command run by the job
        commandId - the id of the command run by the job
        minStarted - The time which the job had to start after in order to be return (inclusive)
        maxStarted - The time which the job had to start before in order to be returned (exclusive)
        minFinished - The time which the job had to finish after in order to be return (inclusive)
        maxFinished - The time which the job had to finish before in order to be returned (exclusive)
        grouping - The grouping the job should be a member of
        groupingInstance - The grouping instance the job should be a member of
        size - The maximum number of results in the page
        sort - The sort order
        page - The page index
        Returns:
        A callable object.
      • getJob

        @GET("/api/v3/jobs/{id}")
        retrofit2.Call<Job> getJob​(@Path("id")
                                   java.lang.String jobId)
        Method to fetch a single job from Genie.
        Parameters:
        jobId - The id of the job to get.
        Returns:
        A callable object.
      • getJobOutputFile

        @Streaming
        @GET("/api/v3/jobs/{id}/output/{path}")
        retrofit2.Call<okhttp3.ResponseBody> getJobOutputFile​(@Path("id")
                                                              java.lang.String jobId,
                                                              @Path(value="path",encoded=true)
                                                              java.lang.String outputFilePath)
        Method to fetch an output file for a job from Genie.

        NOTE: If the specified outputFilePath is a directory, then the directory manifest is returned.

        Parameters:
        jobId - The id of the job whose output file is desired.
        outputFilePath - The path to the file within output directory.
        Returns:
        A callable object.
      • getJobOutputFile

        @Streaming
        @GET("/api/v3/jobs/{id}/output/{path}")
        retrofit2.Call<okhttp3.ResponseBody> getJobOutputFile​(@Path("id")
                                                              java.lang.String jobId,
                                                              @Path(value="path",encoded=true)
                                                              java.lang.String outputFilePath,
                                                              @Header("Range")
                                                              java.lang.String range)
        Method to fetch partial output file for a job from Genie.

        NOTE: If the specified outputFilePath is a directory, then the directory manifest is returned.

        Parameters:
        jobId - The id of the job whose output file is desired.
        outputFilePath - The path to the file within output directory.
        range - The range header value
        Returns:
        A callable object.
      • getJobStatus

        @GET("/api/v3/jobs/{id}/status")
        retrofit2.Call<com.fasterxml.jackson.databind.JsonNode> getJobStatus​(@Path("id")
                                                                             java.lang.String jobId)
        Method to get Job status.
        Parameters:
        jobId - The id of the job whose status is desired.
        Returns:
        A callable object.
      • getJobCluster

        @GET("/api/v3/jobs/{id}/cluster")
        retrofit2.Call<Cluster> getJobCluster​(@Path("id")
                                              java.lang.String jobId)
        Method to get the cluster information on which a job is run.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • getJobCommand

        @GET("/api/v3/jobs/{id}/command")
        retrofit2.Call<Command> getJobCommand​(@Path("id")
                                              java.lang.String jobId)
        Method to get the command information on which a job is run.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • getJobRequest

        @GET("/api/v3/jobs/{id}/request")
        retrofit2.Call<JobRequest> getJobRequest​(@Path("id")
                                                 java.lang.String jobId)
        Method to get the JobRequest for a job.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • getJobExecution

        @GET("/api/v3/jobs/{id}/execution")
        retrofit2.Call<JobExecution> getJobExecution​(@Path("id")
                                                     java.lang.String jobId)
        Method to get the execution information for a job.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • getJobMetadata

        @GET("/api/v3/jobs/{id}/metadata")
        retrofit2.Call<JobMetadata> getJobMetadata​(@Path("id")
                                                   java.lang.String jobId)
        Method to get the metadata information for a job.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • getJobApplications

        @GET("/api/v3/jobs/{id}/applications")
        retrofit2.Call<java.util.List<Application>> getJobApplications​(@Path("id")
                                                                       java.lang.String jobId)
        Method to get the Applications for a job.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.
      • killJob

        @DELETE("/api/v3/jobs/{id}")
        retrofit2.Call<java.lang.Void> killJob​(@Path("id")
                                               java.lang.String jobId)
        Method to send a job kill request to Genie.
        Parameters:
        jobId - The id of the job.
        Returns:
        A callable object.