public class JobServiceImplV21 extends DatabricksService implements JobServiceV21
client, mapper| Constructor and Description |
|---|
JobServiceImplV21(DatabricksRestClient client) |
| Modifier and Type | Method and Description |
|---|---|
String |
buildRunJobRestUrl(long jobId,
long numberInJob)
Formatting databricks job rest url.
|
void |
cancelRun(long runId)
Cancels a run.
|
long |
createJob(JobSettingsDTOv21 jobSettingsDTO)
Creates job from settings DTO.
|
void |
deleteJob(long jobId)
Deletes the job and sends an email to the addresses specified in email_notifications.
|
void |
deleteJob(String jobName)
Deletes a job with a given name.
|
JobDTOv21 |
getJob(long jobId)
Retrieves information about a single job.
|
JobDTOv21 |
getJobByName(String jobName)
Will try and get a job by name.
|
JobDTOv21 |
getJobByName(String jobName,
boolean failOnMultipleJobs)
Will try and get a job by name.
|
String |
getJobLink(long jobId)
Produces the URL of a job given job id.
|
List<JobDTOv21> |
getJobsByName(String jobName)
Retrieves all jobs matching a name exactly.
|
List<JobDTOv21> |
getJobsByRegex(Pattern regex)
Retrieves all jobs with a name matching a given regex.
|
String |
getOutput(long runId)
Retrieve the output of a run.
|
RunDTO |
getRun(long runId)
Retrieves the metadata of a run.
|
List<JobDTOv21> |
listAllJobs()
Returns a list of all jobs that are active.
|
JobsDTOv21 |
listJobs(int limit,
int offset,
boolean expandTasks)
Retrieves a list of jobs.
|
RunsDTO |
listRuns(Long jobId,
Boolean activeOnly,
Integer offset,
Integer limit)
Lists runs from most recently started to least.
|
void |
reset(long jobId,
JobSettingsDTOv21 jobSettings)
"resets" or "edits" a job definition.
|
RunNowDTO |
runJobNow(long jobId)
Runs the job now.
|
RunNowDTO |
runJobNow(long jobId,
Map<String,String> notebookParams)
Runs the job now.
|
RunNowDTO |
runJobNow(long jobId,
RunParametersDTOv21 params)
Runs the job now.
|
RunNowDTO |
runSubmit(RunSubmitDTO runSettings)
Submit a one-time run.
|
void |
upsertJob(JobSettingsDTOv21 jobSettingsDTO,
boolean failOnDuplicateJobNames)
Given a job settings DTO object it will: - try to find the id by name.
|
public JobServiceImplV21(DatabricksRestClient client)
public long createJob(JobSettingsDTOv21 jobSettingsDTO) throws IOException, DatabricksRestException
JobServiceV21createJob in interface JobServiceV21IOExceptionDatabricksRestExceptionpublic void deleteJob(long jobId)
throws IOException,
DatabricksRestException
JobServiceV21deleteJob in interface JobServiceV21jobId - The canonical identifier of the job to deleteIOExceptionDatabricksRestExceptionpublic void deleteJob(String jobName) throws IOException, DatabricksRestException
JobServiceV21deleteJob in interface JobServiceV21jobName - - the job name to delete.IOExceptionDatabricksRestExceptionpublic JobDTOv21 getJob(long jobId) throws IOException, DatabricksRestException
JobServiceV21getJob in interface JobServiceV21jobId - The canonical identifier of the job to retrieve information aboutIOExceptionDatabricksRestExceptionpublic List<JobDTOv21> getJobsByName(String jobName) throws IOException, DatabricksRestException
JobServiceV21getJobsByName in interface JobServiceV21jobName - - the full name of the jobIOExceptionDatabricksRestExceptionpublic JobDTOv21 getJobByName(String jobName) throws IOException, DatabricksRestException
JobServiceV21getJobByName in interface JobServiceV21IOExceptionDatabricksRestExceptionpublic JobDTOv21 getJobByName(String jobName, boolean failOnMultipleJobs) throws IOException, DatabricksRestException
JobServiceV21getJobByName in interface JobServiceV21IOExceptionDatabricksRestExceptionpublic List<JobDTOv21> getJobsByRegex(Pattern regex) throws IOException, DatabricksRestException
JobServiceV21getJobsByRegex in interface JobServiceV21regex - - the regex to earch forIOExceptionDatabricksRestExceptionpublic List<JobDTOv21> listAllJobs() throws DatabricksRestException, IOException
JobServiceV21listAllJobs in interface JobServiceV21DatabricksRestExceptionIOExceptionpublic JobsDTOv21 listJobs(int limit, int offset, boolean expandTasks) throws DatabricksRestException, IOException
JobServiceV21listJobs in interface JobServiceV21limit - The number of jobs to return. This value should be greater than 0 and less than 25.offset - The offset of the first job to return, relative to the most recently created job.expandTasks - Whether to include task and cluster details in the response.
1000 * @see https://docs.databricks.com/api/latest/jobs.html#listDatabricksRestExceptionIOExceptionpublic String getJobLink(long jobId)
JobServiceV21getJobLink in interface JobServiceV21jobId - The canonical identifier of the job to retrieve information aboutpublic RunNowDTO runJobNow(long jobId) throws DatabricksRestException, IOException
JobServiceV21runJobNow in interface JobServiceV21jobId - The job to runDatabricksRestExceptionIOExceptionpublic RunNowDTO runJobNow(long jobId, Map<String,String> notebookParams) throws DatabricksRestException, IOException
JobServiceV21runJobNow in interface JobServiceV21jobId - The job to runnotebookParams - A map from keys to values for jobs with notebook taskDatabricksRestExceptionIOExceptionpublic RunNowDTO runJobNow(long jobId, RunParametersDTOv21 params) throws DatabricksRestException, IOException
JobServiceV21runJobNow in interface JobServiceV21jobId - the job id to runparams - the run parametersDatabricksRestException - any db specific exceptionsIOException - any other exceptionspublic RunsDTO listRuns(Long jobId, Boolean activeOnly, Integer offset, Integer limit) throws DatabricksRestException, IOException
JobServiceV21listRuns in interface JobServiceV21jobId - The job for which to list runs. If omitted,
the Jobs service will list runs from all jobsactiveOnly - If true, lists active runs only; otherwise, lists both active and inactive
runsoffset - The offset of the first run to return, relative to the most recent run. The
default value is 20limit - The number of runs to return. This value should be greater than 0 and less than
1000DatabricksRestExceptionIOExceptionpublic RunDTO getRun(long runId) throws DatabricksRestException, IOException
JobServiceV21getRun in interface JobServiceV21runId - The canonical identifier of the run for which to retrieve the metadataDatabricksRestExceptionIOExceptionpublic void cancelRun(long runId)
throws IOException,
DatabricksRestException
JobServiceV21cancelRun in interface JobServiceV21runId - The desired run to cancelIOExceptionDatabricksRestExceptionpublic void reset(long jobId,
JobSettingsDTOv21 jobSettings)
throws IOException,
DatabricksRestException
JobServiceV21reset in interface JobServiceV21jobId - the job to editjobSettings - the settings to change the job toIOException - any other errorsDatabricksRestException - any specific db errorspublic String buildRunJobRestUrl(long jobId, long numberInJob)
JobServiceV21buildRunJobRestUrl in interface JobServiceV21public void upsertJob(JobSettingsDTOv21 jobSettingsDTO, boolean failOnDuplicateJobNames) throws IOException, DatabricksRestException
JobServiceV21upsertJob in interface JobServiceV21IOExceptionDatabricksRestExceptionpublic RunNowDTO runSubmit(RunSubmitDTO runSettings) throws IOException, DatabricksRestException
JobServiceV21runSubmit in interface JobServiceV21runSettings - the settings to change the job toIOExceptionDatabricksRestExceptionpublic String getOutput(long runId) throws IOException, DatabricksRestException
JobServiceV21getOutput in interface JobServiceV21runId - The desired run idIOExceptionDatabricksRestExceptionCopyright © 2023. All rights reserved.