use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class SchedulerService method getContentCleanerJob.
public Job getContentCleanerJob() throws SchedulerException {
IPentahoSession session = getSession();
// this authentication wasn't matching with the job user name,
final String principalName = session.getName();
// changed to get name via the current session
final Boolean canAdminister = getPolicy().isAllowed(AdministerSecurityAction.NAME);
List<Job> jobs = getScheduler().getJobs(getJobFilter(canAdminister, principalName));
if (jobs.size() > 0) {
return jobs.get(0);
}
return null;
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class SchedulerService method triggerNow.
public Job triggerNow(String jobId) throws SchedulerException {
Job job = getScheduler().getJob(jobId);
if (getPolicy().isAllowed(SchedulerAction.NAME)) {
getScheduler().triggerNow(jobId);
} else {
if (getSession().getName().equals(job.getUserName())) {
getScheduler().triggerNow(jobId);
}
}
// udpate job state
job = getScheduler().getJob(jobId);
return job;
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class SchedulerService method getJobs.
public List<Job> getJobs() throws SchedulerException {
IPentahoSession session = getSession();
// this authentication wasn't matching with the job user name,
final String principalName = session.getName();
// changed to get name via the current session
final Boolean canAdminister = canAdminister(session);
List<Job> jobs = getScheduler().getJobs(new IJobFilter() {
@Override
public boolean accept(Job job) {
if (canAdminister) {
return !IBlockoutManager.BLOCK_OUT_JOB_NAME.equals(job.getJobName());
}
return principalName.equals(job.getUserName());
}
});
return jobs;
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class SchedulerService method getJobInfo.
public Job getJobInfo(String jobId) throws SchedulerException {
Job job = getJob(jobId);
if (job == null) {
return null;
}
if (canAdminister() || getSession().getName().equals(job.getUserName())) {
for (String key : job.getJobParams().keySet()) {
Serializable value = job.getJobParams().get(key);
if (value != null && value.getClass() != null && value.getClass().isArray()) {
String[] sa = (new String[0]).getClass().cast(value);
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < sa.length; i++) {
list.add(sa[i]);
}
job.getJobParams().put(key, list);
}
}
return job;
} else {
throw new RuntimeException("Job not found or improper credentials for access");
}
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class RepositoryCleanerSystemListener method unscheduleJob.
private void unscheduleJob(IScheduler scheduler, List<Job> jobs) throws SchedulerException {
for (Job job : jobs) {
logger.info("Removing job with id: " + job.getJobId());
scheduler.removeJob(job.getJobId());
}
}
Aggregations