public class JobServiceImpl extends DatabricksService implements JobService
client, mapper
Constructor and Description |
---|
JobServiceImpl(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(JobSettingsDTO 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.
|
JobDTO |
getJob(long jobId)
Retrieves information about a single job.
|
JobDTO |
getJobByName(String jobName)
Will try and get a job by name.
|
JobDTO |
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<JobDTO> |
getJobsByName(String jobName)
Retrieves all jobs matching a name exactly.
|
List<JobDTO> |
getJobsByRegex(Pattern regex)
Retrieves all jobs with a name matching a given regex.
|
RunDTO |
getRun(long runId)
Retrieves the metadata of a run.
|
JobsDTO |
listAllJobs()
Returns a list of all jobs that are active.
|
RunsDTO |
listRuns(Long jobId,
Boolean activeOnly,
Integer offset,
Integer limit)
Lists runs from most recently started to least.
|
void |
reset(long jobId,
JobSettingsDTO 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,
RunParametersDTO params)
Runs the job now.
|
void |
upsertJob(JobSettingsDTO jobSettingsDTO,
boolean failOnDuplicateJobNames)
Given a job settings DTO object it will: - try to find the id by name.
|
public JobServiceImpl(DatabricksRestClient client)
public long createJob(JobSettingsDTO jobSettingsDTO) throws IOException, DatabricksRestException
JobService
createJob
in interface JobService
IOException
DatabricksRestException
public void deleteJob(long jobId) throws IOException, DatabricksRestException
JobService
deleteJob
in interface JobService
jobId
- The canonical identifier of the job to deleteIOException
DatabricksRestException
public void deleteJob(String jobName) throws IOException, DatabricksRestException
JobService
deleteJob
in interface JobService
jobName
- - the job name to delete.IOException
DatabricksRestException
public JobDTO getJob(long jobId) throws IOException, DatabricksRestException
JobService
getJob
in interface JobService
jobId
- The canonical identifier of the job to retrieve information aboutIOException
DatabricksRestException
public List<JobDTO> getJobsByName(String jobName) throws IOException, DatabricksRestException
JobService
getJobsByName
in interface JobService
jobName
- - the full name of the jobIOException
DatabricksRestException
public JobDTO getJobByName(String jobName) throws IOException, DatabricksRestException
JobService
getJobByName
in interface JobService
IOException
DatabricksRestException
public JobDTO getJobByName(String jobName, boolean failOnMultipleJobs) throws IOException, DatabricksRestException
JobService
getJobByName
in interface JobService
IOException
DatabricksRestException
public List<JobDTO> getJobsByRegex(Pattern regex) throws IOException, DatabricksRestException
JobService
getJobsByRegex
in interface JobService
regex
- - the regex to earch forIOException
DatabricksRestException
public JobsDTO listAllJobs() throws DatabricksRestException, IOException
JobService
listAllJobs
in interface JobService
DatabricksRestException
IOException
public String getJobLink(long jobId)
JobService
getJobLink
in interface JobService
jobId
- The canonical identifier of the job to retrieve information aboutpublic RunNowDTO runJobNow(long jobId) throws DatabricksRestException, IOException
JobService
runJobNow
in interface JobService
jobId
- The job to runDatabricksRestException
IOException
public RunNowDTO runJobNow(long jobId, Map<String,String> notebookParams) throws DatabricksRestException, IOException
JobService
runJobNow
in interface JobService
jobId
- The job to runnotebookParams
- A map from keys to values for jobs with notebook taskDatabricksRestException
IOException
public RunNowDTO runJobNow(long jobId, RunParametersDTO params) throws DatabricksRestException, IOException
JobService
runJobNow
in interface JobService
jobId
- 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
JobService
listRuns
in interface JobService
jobId
- 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
1000DatabricksRestException
IOException
public RunDTO getRun(long runId) throws DatabricksRestException, IOException
JobService
getRun
in interface JobService
runId
- The canonical identifier of the run for which to retrieve the metadataDatabricksRestException
IOException
public void cancelRun(long runId) throws IOException, DatabricksRestException
JobService
cancelRun
in interface JobService
runId
- The desired run to cancelIOException
DatabricksRestException
public void reset(long jobId, JobSettingsDTO jobSettings) throws IOException, DatabricksRestException
JobService
reset
in interface JobService
jobId
- the job to editjobSettings
- the settings to change the job toIOException
- any other errorsDatabricksRestException
- any specific db errorspublic String buildRunJobRestUrl(long jobId, long numberInJob)
JobService
buildRunJobRestUrl
in interface JobService
public void upsertJob(JobSettingsDTO jobSettingsDTO, boolean failOnDuplicateJobNames) throws IOException, DatabricksRestException
JobService
upsertJob
in interface JobService
IOException
DatabricksRestException
Copyright © 2018. All rights reserved.