use of io.hops.hopsworks.persistence.entity.jobs.configuration.history.JobState in project hopsworks by logicalclocks.
the class JobFacade method setFilterQuery.
private void setFilterQuery(AbstractFacade.FilterBy filterBy, Query q) {
switch(Filters.valueOf(filterBy.getValue())) {
case JOBTYPE:
case JOBTYPE_NEQ:
Set<JobType> jobTypes = new HashSet<>(getJobTypes(filterBy.getField(), filterBy.getParam()));
q.setParameter(filterBy.getField(), jobTypes);
break;
case DATE_CREATED:
case DATE_CREATED_GT:
case DATE_CREATED_LT:
Date date = getDate(filterBy.getField(), filterBy.getParam());
q.setParameter(filterBy.getField(), date);
break;
case NAME:
q.setParameter(filterBy.getField(), filterBy.getParam());
break;
case CREATOR:
case LATEST_EXECUTION:
q.setParameter(filterBy.getField(), filterBy.getParam());
q.setParameter("searchUpper", filterBy.getParam().toUpperCase());
break;
case LATEST_EXECUTION_STATE:
Set<JobState> jobStates = new HashSet<>(getJobStates(filterBy.getField(), filterBy.getParam()));
q.setParameter(filterBy.getField(), jobStates);
break;
default:
break;
}
}
use of io.hops.hopsworks.persistence.entity.jobs.configuration.history.JobState in project hopsworks by logicalclocks.
the class JobFacade method getJobStates.
private Set<JobState> getJobStates(String field, String values) {
String[] jobStatesArr = values.split(",");
Set<JobState> jobStates = new HashSet<>();
for (String jobState : jobStatesArr) {
try {
jobStates.add(JobState.valueOf(jobState.trim().toUpperCase()));
} catch (IllegalArgumentException ie) {
throw new InvalidQueryException("Filter value for " + field + " needs to set a valid " + field + ", but found: " + jobState);
}
}
if (jobStates.isEmpty()) {
throw new InvalidQueryException("Filter value for " + field + " needs to set valid job state, but found: " + values);
}
return jobStates;
}
use of io.hops.hopsworks.persistence.entity.jobs.configuration.history.JobState in project hopsworks by logicalclocks.
the class ExecutionFacade method setFilterQuery.
private void setFilterQuery(AbstractFacade.FilterBy filterBy, Query q) {
switch(Filters.valueOf(filterBy.getValue())) {
case STATE:
case STATE_NEQ:
Set<JobState> jobTypes = new HashSet<>(getJobStates(filterBy.getField(), filterBy.getParam()));
q.setParameter(filterBy.getField(), jobTypes);
break;
case SUBMISSIONTIME_GT:
case SUBMISSIONTIME_LT:
case SUBMISSIONTIME:
Date date = getDate(filterBy.getField(), filterBy.getParam());
q.setParameter(filterBy.getField(), date);
break;
case FINALSTATUS:
case FINALSTATUS_NEQ:
Set<JobFinalStatus> jobFinalStatuses = new HashSet<>(getJobFinalStatus(filterBy.getField(), filterBy.getParam()));
q.setParameter(filterBy.getField(), jobFinalStatuses);
break;
default:
break;
}
}
Aggregations