@Validated
public interface PersistenceService
Modifier and Type | Method and Description |
---|---|
void |
addApplicationsForCommand(@NotBlank java.lang.String id,
@NotEmpty java.util.List<java.lang.String> applicationIds)
Add applications for the command.
|
void |
addClusterCriterionForCommand(java.lang.String id,
@Valid Criterion criterion)
Add a new
Criterion to the existing list of cluster criteria for the command identified by id. |
void |
addClusterCriterionForCommand(java.lang.String id,
@Valid Criterion criterion,
@Min(value=0L) int priority)
Add a new
Criterion to the existing list of cluster criteria for the command identified by id. |
<R extends CommonResource> |
addConfigsToResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> configs,
java.lang.Class<R> resourceClass)
Add configuration files to the existing set for a resource.
|
<R extends CommonResource> |
addDependenciesToResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> dependencies,
java.lang.Class<R> resourceClass)
Add dependency files to the existing set for a resource.
|
<R extends CommonResource> |
addTagsToResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> tags,
java.lang.Class<R> resourceClass)
Add tags to the existing set for a resource.
|
void |
claimJob(@NotBlank java.lang.String id,
@Valid AgentClientMetadata agentClientMetadata)
Set a job identified by
id to be owned by the agent identified by agentClientMetadata . |
void |
deleteAllApplications()
Delete all applications from the system.
|
void |
deleteAllClusters()
Delete all clusters from database.
|
void |
deleteAllCommands()
Delete all commands from the system.
|
void |
deleteApplication(@NotBlank java.lang.String id)
Delete an
Application from the system. |
void |
deleteCluster(@NotBlank java.lang.String id)
Delete a
Cluster by id. |
void |
deleteCommand(@NotBlank java.lang.String id)
Delete a
Command from system. |
long |
deleteJobsCreatedBefore(@NotNull java.time.Instant creationThreshold,
@NotNull java.util.Set<JobStatus> excludeStatuses,
@Min(value=1L) int batchSize)
This method will delete a chunk of jobs whose creation time is earlier than the given date.
|
long |
deleteUnusedApplications(@NotNull java.time.Instant createdThreshold,
@Min(value=1L) int batchSize)
Delete any unused applications that were created before the given time.
|
long |
deleteUnusedClusters(java.util.Set<ClusterStatus> deleteStatuses,
@NotNull java.time.Instant clusterCreatedThreshold,
@Min(value=1L) int batchSize)
Delete all clusters that are in one of the given states, aren't attached to any jobs and were created before
the given time.
|
long |
deleteUnusedCommands(java.util.Set<CommandStatus> deleteStatuses,
@NotNull java.time.Instant commandCreatedThreshold,
@Min(value=1L) int batchSize)
Bulk delete commands from the database where their status is in deleteStatuses they were created
before commandCreatedThreshold and they aren't attached to any jobs still in the database.
|
long |
deleteUnusedFiles(@NotNull java.time.Instant createdThreshold,
@Min(value=1L) int batchSize)
Delete all files from the database that aren't referenced which were created before the supplied created
threshold.
|
long |
deleteUnusedTags(@NotNull java.time.Instant createdThreshold,
@Min(value=1L) int batchSize)
Delete all tags from the database that aren't referenced which were created before the supplied created
threshold.
|
org.springframework.data.domain.Page<Application> |
findApplications(java.lang.String name,
java.lang.String user,
java.util.Set<ApplicationStatus> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String type,
org.springframework.data.domain.Pageable page)
Find applications which match the given filter criteria.
|
org.springframework.data.domain.Page<Cluster> |
findClusters(java.lang.String name,
java.util.Set<ClusterStatus> statuses,
java.util.Set<java.lang.String> tags,
java.time.Instant minUpdateTime,
java.time.Instant maxUpdateTime,
org.springframework.data.domain.Pageable page)
Find and
Cluster s that match the given parameters. |
java.util.Set<Cluster> |
findClustersMatchingAnyCriterion(@NotEmpty java.util.Set<Criterion> criteria,
boolean addDefaultStatus)
|
java.util.Set<Cluster> |
findClustersMatchingCriterion(@Valid Criterion criterion,
boolean addDefaultStatus)
|
org.springframework.data.domain.Page<Command> |
findCommands(java.lang.String name,
java.lang.String user,
java.util.Set<CommandStatus> statuses,
java.util.Set<java.lang.String> tags,
org.springframework.data.domain.Pageable page)
Find commands matching the given filter criteria.
|
java.util.Set<Command> |
findCommandsMatchingCriterion(@Valid Criterion criterion,
boolean addDefaultStatus)
|
org.springframework.data.domain.Page<JobSearchResult> |
findJobs(java.lang.String id,
java.lang.String name,
java.lang.String user,
java.util.Set<JobStatus> 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.time.Instant minStarted,
java.time.Instant maxStarted,
java.time.Instant minFinished,
java.time.Instant maxFinished,
java.lang.String grouping,
java.lang.String groupingInstance,
@NotNull org.springframework.data.domain.Pageable page)
Find jobs which match the given filter criteria.
|
long |
getActiveJobCountForUser(@NotBlank java.lang.String user)
Get the count of 'active' jobs for a given user across all instances.
|
java.util.Set<java.lang.String> |
getActiveJobs()
Get the set of active jobs.
|
Application |
getApplication(@NotBlank java.lang.String id)
Get the application metadata for given id.
|
java.util.List<Application> |
getApplicationsForCommand(java.lang.String id)
Get the applications for a given command.
|
Cluster |
getCluster(@NotBlank java.lang.String id)
Get the
Cluster identified by the given id. |
java.util.List<Criterion> |
getClusterCriteriaForCommand(java.lang.String id)
For the given command id return the Cluster
Criterion in priority order that is currently
associated with this command if any. |
java.util.Set<Cluster> |
getClustersForCommand(@NotBlank java.lang.String id,
java.util.Set<ClusterStatus> statuses)
Get all the clusters the command with given id is associated with.
|
Command |
getCommand(@NotBlank java.lang.String id)
Get the metadata for the
Command identified by the id. |
java.util.Set<Command> |
getCommandsForApplication(@NotBlank java.lang.String id,
java.util.Set<CommandStatus> statuses)
Get all the commands the application with given id is associated with.
|
<R extends CommonResource> |
getConfigsForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Get the set of configuration files associated with the resource with the given id.
|
<R extends CommonResource> |
getDependenciesForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Get the set of dependency files associated with the resource with the given id.
|
FinishedJob |
getFinishedJob(@NotBlank java.lang.String id)
Get a DTO representing a finished job.
|
JobInfoAggregate |
getHostJobInformation(@NotBlank java.lang.String hostname)
Get all the aggregate metadata information about jobs running on a given hostname.
|
Job |
getJob(@NotBlank java.lang.String id)
Get job information for given job id.
|
java.util.List<Application> |
getJobApplications(@NotBlank java.lang.String id)
Get the applications the job used or is currently using.
|
java.util.Optional<java.lang.String> |
getJobArchiveLocation(@NotBlank java.lang.String id)
Get the location a job directory was archived to if at all.
|
ArchiveStatus |
getJobArchiveStatus(@NotBlank java.lang.String id)
Get the archive status for a job with the given
id . |
Cluster |
getJobCluster(@NotBlank java.lang.String id)
Get the cluster the job used or is using.
|
Command |
getJobCommand(@NotBlank java.lang.String id)
Get the command the job used or is using.
|
JobExecution |
getJobExecution(@NotBlank java.lang.String id)
Get job execution for given job id.
|
JobMetadata |
getJobMetadata(@NotBlank java.lang.String id)
Get the metadata about a job.
|
JobRequest |
getJobRequest(@NotBlank java.lang.String id)
Get the original request for a job.
|
java.util.Optional<JobSpecification> |
getJobSpecification(@NotBlank java.lang.String id)
Get the saved job specification for the given job.
|
JobStatus |
getJobStatus(@NotBlank java.lang.String id)
Get the status for a job with the given
id . |
java.util.Set<java.lang.String> |
getJobsWithStatusAndArchiveStatusUpdatedBefore(@NotEmpty java.util.Set<JobStatus> statuses,
@NotEmpty java.util.Set<ArchiveStatus> archiveStatuses,
@NotNull java.time.Instant updated)
Get the set of jobs (agent only) whose state is in
statuses and archive status is in
archiveStatuses and last updated before updated . |
com.fasterxml.jackson.databind.JsonNode |
getLauncherExt(@NotBlank java.lang.String id)
Get the job requested launcher extension.
|
com.fasterxml.jackson.databind.JsonNode |
getRequestedLauncherExt(@NotBlank java.lang.String id)
Get the command the job used or is using.
|
<R extends CommonResource> |
getTagsForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Get the set of tags associated with the resource with the given id.
|
java.util.Set<java.lang.String> |
getUnclaimedJobs()
Get the set of jobs in that have not reached CLAIMED state.
|
long |
getUsedMemoryOnHost(@NotBlank java.lang.String hostname)
Get the amount of memory currently used on the given host by Genie jobs in any of the following states.
|
java.util.Map<java.lang.String,UserResourcesSummary> |
getUserResourcesSummaries(java.util.Set<JobStatus> statuses,
boolean api)
Get a map of summaries of resources usage for each user with at least one active job.
|
JobRequest |
getV3JobRequest(@NotBlank java.lang.String id)
Deprecated.
|
boolean |
isApiJob(@NotBlank java.lang.String id)
Get whether the job with the given ID was submitted via the REST API or other mechanism.
|
void |
removeAllClusterCriteriaForCommand(java.lang.String id)
Remove all the
Criterion currently associated with the command identified by id. |
<R extends CommonResource> |
removeAllConfigsForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Remove all configuration files from the resource.
|
<R extends CommonResource> |
removeAllDependenciesForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Remove all dependency files from the resource.
|
<R extends CommonResource> |
removeAllTagsForResource(@NotBlank java.lang.String id,
java.lang.Class<R> resourceClass)
Remove all tags from the resource.
|
void |
removeApplicationForCommand(@NotBlank java.lang.String id,
@NotBlank java.lang.String appId)
Remove the application from the command.
|
void |
removeApplicationsForCommand(@NotBlank java.lang.String id)
Remove all the applications from the command.
|
void |
removeClusterCriterionForCommand(java.lang.String id,
@Min(value=0L) int priority)
Remove the
Criterion with the given priority from the current list of cluster criteria
associated with the command identified by id. |
<R extends CommonResource> |
removeConfigForResource(@NotBlank java.lang.String id,
@NotBlank java.lang.String config,
java.lang.Class<R> resourceClass)
Remove a configuration file from the given resource.
|
<R extends CommonResource> |
removeDependencyForResource(@NotBlank java.lang.String id,
@NotBlank java.lang.String dependency,
java.lang.Class<R> resourceClass)
Remove a dependency file from the given resource.
|
<R extends CommonResource> |
removeTagForResource(@NotBlank java.lang.String id,
@NotBlank java.lang.String tag,
java.lang.Class<R> resourceClass)
Remove a tag from the given resource.
|
java.lang.String |
saveApplication(@Valid ApplicationRequest applicationRequest)
Save a new application.
|
java.lang.String |
saveCluster(@Valid ClusterRequest clusterRequest)
Save a
Cluster . |
java.lang.String |
saveCommand(@Valid CommandRequest commandRequest)
Save a
Command in the system based on the given CommandRequest . |
java.lang.String |
saveJobSubmission(@Valid JobSubmission jobSubmission)
Save the given job submission information in the underlying data store.
|
void |
saveResolvedJob(@NotBlank java.lang.String id,
@Valid ResolvedJob resolvedJob)
Save the given resolved details for a job.
|
void |
setApplicationsForCommand(@NotBlank java.lang.String id,
@NotNull java.util.List<java.lang.String> applicationIds)
Set the applications for the command.
|
void |
setClusterCriteriaForCommand(java.lang.String id,
java.util.List<Criterion> clusterCriteria)
For the command identified by id reset the entire list of cluster criteria to match the contents of
clusterCriteria.
|
void |
updateApplication(@NotBlank java.lang.String id,
@Valid Application updateApp)
Update an
Application . |
void |
updateCluster(@NotBlank java.lang.String id,
@Valid Cluster updateCluster)
Update a
Cluster with the given information. |
void |
updateCommand(@NotBlank java.lang.String id,
@Valid Command updateCommand)
Update a
Command . |
<R extends CommonResource> |
updateConfigsForResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> configs,
java.lang.Class<R> resourceClass)
Update the set of configuration files associated with the resource with the given id.
|
<R extends CommonResource> |
updateDependenciesForResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> dependencies,
java.lang.Class<R> resourceClass)
Update the set of dependency files associated with the resource with the given id.
|
void |
updateJobArchiveStatus(@NotBlank(message="No job id entered. Unable to update.") java.lang.String id,
@NotNull(message="Status cannot be null.") ArchiveStatus archiveStatus)
Update the status and status message of the job.
|
void |
updateJobStatus(@NotBlank java.lang.String id,
@NotNull JobStatus currentStatus,
@NotNull JobStatus newStatus,
java.lang.String newStatusMessage)
Update the status of the job identified with
id to be newStatus provided that the current status
of the job matches newStatus . |
void |
updateLauncherExt(@NotBlank(message="No job id entered. Unable to update.") java.lang.String id,
@NotNull(message="Status cannot be null.") com.fasterxml.jackson.databind.JsonNode launcherExtension)
Update the launcher extension field for this job.
|
void |
updateRequestedLauncherExt(@NotBlank(message="No job id entered. Unable to update.") java.lang.String id,
@NotNull(message="Status cannot be null.") com.fasterxml.jackson.databind.JsonNode launcherExtension)
Update the requested launcher extension field for this job.
|
int |
updateStatusForUnusedCommands(CommandStatus desiredStatus,
java.time.Instant commandCreatedThreshold,
java.util.Set<CommandStatus> currentStatuses,
int batchSize)
Update the status of a command to the desiredStatus if its status is in currentStatuses,
it was created before commandCreatedThreshold and it hasn't been used in any job.
|
<R extends CommonResource> |
updateTagsForResource(@NotBlank java.lang.String id,
java.util.Set<java.lang.String> tags,
java.lang.Class<R> resourceClass)
Update the set of tags associated with the resource with the given id.
|
java.lang.String saveApplication(@Valid @Valid ApplicationRequest applicationRequest) throws IdAlreadyExistsException
applicationRequest
- The ApplicationRequest
containing the metadata of the application to createIdAlreadyExistsException
- If the ID is already used by another applicationApplication getApplication(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- unique id for application configuration to get. Not null/empty.Application
NotFoundException
- if no application with id existsorg.springframework.data.domain.Page<Application> findApplications(@Nullable java.lang.String name, @Nullable java.lang.String user, @Nullable java.util.Set<ApplicationStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, @Nullable java.lang.String type, org.springframework.data.domain.Pageable page)
name
- Name of the application. Can be null or empty.user
- The user who created the application. Can be null/emptystatuses
- The statuses of the applications to find. Can be null.tags
- Tags allocated to this applicationtype
- The type of the application to findpage
- The page requested for the search resultsvoid updateApplication(@NotBlank @NotBlank java.lang.String id, @Valid @Valid Application updateApp) throws NotFoundException, PreconditionFailedException
Application
.id
- The id of the application to updateupdateApp
- Information to update for the application configuration withNotFoundException
- If no Application
with id existsPreconditionFailedException
- If id and updateApp id don't matchvoid deleteAllApplications() throws PreconditionFailedException
PreconditionFailedException
- When any Application
is still associated with a commandvoid deleteApplication(@NotBlank @NotBlank java.lang.String id) throws PreconditionFailedException
Application
from the system.id
- unique id of the application to deletePreconditionFailedException
- When the Application
is still used by any commandjava.util.Set<Command> getCommandsForApplication(@NotBlank @NotBlank java.lang.String id, @Nullable java.util.Set<CommandStatus> statuses) throws NotFoundException
id
- The id of the application to get the commands for.statuses
- The desired status(es) to filter the associated commands forNotFoundException
- If no Application
with id existslong deleteUnusedApplications(@NotNull @NotNull java.time.Instant createdThreshold, @Min(value=1L) @Min(value=1L) int batchSize)
createdThreshold
- The instant in time that any application had to be created before (exclusive) to be
considered for deletion. Presents ability to filter out newly created applications if
desired.batchSize
- The maximum number of applications to delete in a single transactionjava.lang.String saveCluster(@Valid @Valid ClusterRequest clusterRequest) throws IdAlreadyExistsException
Cluster
.clusterRequest
- The cluster information to saveIdAlreadyExistsException
- If a Cluster
with the given id already existsCluster getCluster(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
Cluster
identified by the given id.id
- unique id of the Cluster
to getCluster
NotFoundException
- If no Cluster
with id existsorg.springframework.data.domain.Page<Cluster> findClusters(@Nullable java.lang.String name, @Nullable java.util.Set<ClusterStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, @Nullable java.time.Instant minUpdateTime, @Nullable java.time.Instant maxUpdateTime, org.springframework.data.domain.Pageable page)
Cluster
s that match the given parameters. Null or empty parameters are ignored.name
- cluster namestatuses
- ClusterStatus
that clusters must be in to be matchedtags
- tags attached to this clusterminUpdateTime
- min time when cluster was updatedmaxUpdateTime
- max time when cluster was updatedpage
- The page to getvoid updateCluster(@NotBlank @NotBlank java.lang.String id, @Valid @Valid Cluster updateCluster) throws NotFoundException, PreconditionFailedException
Cluster
with the given information.id
- The id of the cluster to updateupdateCluster
- The information to update the cluster withNotFoundException
- If no Cluster
with id existsPreconditionFailedException
- If the id doesn't match the updateCluster idvoid deleteAllClusters() throws PreconditionFailedException
PreconditionFailedException
- If the cluster is still associated with any jobvoid deleteCluster(@NotBlank @NotBlank java.lang.String id) throws PreconditionFailedException
Cluster
by id.id
- unique id of the cluster to deletePreconditionFailedException
- If the cluster is still associated with any joblong deleteUnusedClusters(java.util.Set<ClusterStatus> deleteStatuses, @NotNull @NotNull java.time.Instant clusterCreatedThreshold, @Min(value=1L) @Min(value=1L) int batchSize)
deleteStatuses
- The set of ClusterStatus
a cluster must be in to be considered for
deletion.clusterCreatedThreshold
- The instant in time before which a cluster must have been created to be
considered for deletion. Exclusive.batchSize
- The maximum number of clusters to delete in a single transactionjava.util.Set<Cluster> findClustersMatchingCriterion(@Valid @Valid Criterion criterion, boolean addDefaultStatus)
criterion
- The Criterion
supplied that each cluster needs to completely match to be returnedaddDefaultStatus
- true if the a default status should be added to the supplied
Criterion
if the supplied criterion doesn't already have a statusCluster
's which matched the Criterion
java.util.Set<Cluster> findClustersMatchingAnyCriterion(@NotEmpty @NotEmpty java.util.Set<Criterion> criteria, boolean addDefaultStatus)
criteria
- The set of Criterion
supplied that a cluster needs to completely match at least
one of to be returnedaddDefaultStatus
- true if the a default status should be added to the supplied
Criterion
if the supplied criterion doesn't already have a statusCluster
's which matched the Criterion
java.lang.String saveCommand(@Valid @Valid CommandRequest commandRequest) throws IdAlreadyExistsException
Command
in the system based on the given CommandRequest
.commandRequest
- encapsulates the command configuration information to createIdAlreadyExistsException
- If there was a conflict on the unique id for the commandCommand getCommand(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
Command
identified by the id.id
- unique id for command to get. Not null/empty.NotFoundException
- If no Command
exists with the given idorg.springframework.data.domain.Page<Command> findCommands(@Nullable java.lang.String name, @Nullable java.lang.String user, @Nullable java.util.Set<CommandStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, org.springframework.data.domain.Pageable page)
name
- Name of command configuser
- The name of the user who created the configurationstatuses
- The status of the commands to get. Can be null.tags
- tags allocated to this commandpage
- The page of results to getvoid updateCommand(@NotBlank @NotBlank java.lang.String id, @Valid @Valid Command updateCommand) throws NotFoundException, PreconditionFailedException
Command
.id
- The id of the command configuration to update. Not null or empty.updateCommand
- contains the information to update the command withNotFoundException
- If no Command
exists with the given idPreconditionFailedException
- When the id doesn't match the id of updateCommandvoid deleteAllCommands() throws PreconditionFailedException
PreconditionFailedException
- If any constraint is violated trying to delete a commandvoid deleteCommand(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
Command
from system.id
- unique if of the command to deleteNotFoundException
- If no Command
exists with the given idvoid addApplicationsForCommand(@NotBlank @NotBlank java.lang.String id, @NotEmpty @NotEmpty java.util.List<java.lang.String> applicationIds) throws NotFoundException, PreconditionFailedException
id
- The id of the command to add the application file to. Not null/empty/blank.applicationIds
- The ids of the applications to add. Not null.NotFoundException
- If no Command
exists with the given id or one of the
applications doesn't existPreconditionFailedException
- If an application with one of the ids is already associated with the commandvoid setApplicationsForCommand(@NotBlank @NotBlank java.lang.String id, @NotNull @NotNull java.util.List<java.lang.String> applicationIds) throws NotFoundException, PreconditionFailedException
id
- The id of the command to add the application file to. Not null/empty/blank.applicationIds
- The ids of the applications to set. Not null.NotFoundException
- If no Command
exists with the given id or one of the
applications doesn't existPreconditionFailedException
- If there are duplicate application ids in the listjava.util.List<Application> getApplicationsForCommand(java.lang.String id) throws NotFoundException
id
- The id of the command to get the application for. Not null/empty/blank.NotFoundException
- If no Command
exists with the given idvoid removeApplicationsForCommand(@NotBlank @NotBlank java.lang.String id) throws NotFoundException, PreconditionFailedException
id
- The id of the command to remove the application from. Not null/empty/blank.NotFoundException
- If no Command
exists with the given idPreconditionFailedException
- If applications are unable to be removedvoid removeApplicationForCommand(@NotBlank @NotBlank java.lang.String id, @NotBlank @NotBlank java.lang.String appId) throws NotFoundException
id
- The id of the command to remove the application from. Not null/empty/blank.appId
- The id of the application to remove. Not null/empty/blankNotFoundException
- If no Command
exists with the given idjava.util.Set<Cluster> getClustersForCommand(@NotBlank @NotBlank java.lang.String id, @Nullable java.util.Set<ClusterStatus> statuses) throws NotFoundException
id
- The id of the command to get the clusters for.statuses
- The status of the clusters returnedNotFoundException
- If no Command
exists with the given idjava.util.List<Criterion> getClusterCriteriaForCommand(java.lang.String id) throws NotFoundException
Criterion
in priority order that is currently
associated with this command if any.id
- The id of the command to get the criteria forNotFoundException
- If no command with id existsvoid addClusterCriterionForCommand(java.lang.String id, @Valid @Valid Criterion criterion) throws NotFoundException
Criterion
to the existing list of cluster criteria for the command identified by id.
This new criterion will be the lowest priority criterion.id
- The id of the command to add tocriterion
- The new Criterion
to addNotFoundException
- If no command with id existsvoid addClusterCriterionForCommand(java.lang.String id, @Valid @Valid Criterion criterion, @Min(value=0L) @Min(value=0L) int priority) throws NotFoundException
Criterion
to the existing list of cluster criteria for the command identified by id.
The priority is the place in the list this new criterion should be placed. A value of 0
indicates it should be placed at the front of the list with the highest possible priority. 1 would be
second in the list etc. If priority is > the current size of the cluster criteria list
this new criterion will be placed at the end as the lowest priority item.id
- The id of the command to add tocriterion
- The new Criterion
to addpriority
- The place in the existing cluster criteria list this new criterion should be placed. Min 0.NotFoundException
- If no command with id existsvoid setClusterCriteriaForCommand(java.lang.String id, java.util.List<Criterion> clusterCriteria) throws NotFoundException
id
- The id of the command to set the cluster criteria forclusterCriteria
- The priority list of Criterion
to setNotFoundException
- If no command with id existsvoid removeClusterCriterionForCommand(java.lang.String id, @Min(value=0L) @Min(value=0L) int priority) throws NotFoundException
Criterion
with the given priority from the current list of cluster criteria
associated with the command identified by id. A value of 0 for priority
will result in the first element in the list being removed, 1 the second element and so on.id
- The id of the command to remove the criterion frompriority
- The priority of the criterion to removeNotFoundException
- If no command with id existsvoid removeAllClusterCriteriaForCommand(java.lang.String id) throws NotFoundException
Criterion
currently associated with the command identified by id.id
- The id of the command to remove the criteria fromNotFoundException
- If no command with id existsjava.util.Set<Command> findCommandsMatchingCriterion(@Valid @Valid Criterion criterion, boolean addDefaultStatus)
int updateStatusForUnusedCommands(CommandStatus desiredStatus, java.time.Instant commandCreatedThreshold, java.util.Set<CommandStatus> currentStatuses, int batchSize)
desiredStatus
- The new status the matching commands should havecommandCreatedThreshold
- The instant in time which a command must have been created before to be
considered for update. ExclusivecurrentStatuses
- The set of current statuses a command must have to be considered for updatebatchSize
- The maximum number of commands to update in a single transactionlong deleteUnusedCommands(java.util.Set<CommandStatus> deleteStatuses, @NotNull @NotNull java.time.Instant commandCreatedThreshold, @Min(value=1L) @Min(value=1L) int batchSize)
deleteStatuses
- The set of statuses a command must be in in order to be considered for deletioncommandCreatedThreshold
- The instant in time a command must have been created before to be considered for
deletion. Exclusive.batchSize
- The maximum number of commands to delete in a single transaction@Deprecated JobRequest getV3JobRequest(@NotBlank @NotBlank java.lang.String id) throws GenieException
id
- id of job request to look upGenieException
- if there is an errorJob getJob(@NotBlank @NotBlank java.lang.String id) throws GenieException
id
- id of job to look upGenieException
- if there is an errorJobExecution getJobExecution(@NotBlank @NotBlank java.lang.String id) throws GenieException
id
- id of job execution to look upGenieException
- if there is an errorJobMetadata getJobMetadata(@NotBlank @NotBlank java.lang.String id) throws GenieException
id
- The id of the job to get metadata forGenieException
- If any error occursorg.springframework.data.domain.Page<JobSearchResult> findJobs(@Nullable java.lang.String id, @Nullable java.lang.String name, @Nullable java.lang.String user, @Nullable java.util.Set<JobStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, @Nullable java.lang.String clusterName, @Nullable java.lang.String clusterId, @Nullable java.lang.String commandName, @Nullable java.lang.String commandId, @Nullable java.time.Instant minStarted, @Nullable java.time.Instant maxStarted, @Nullable java.time.Instant minFinished, @Nullable java.time.Instant maxFinished, @Nullable java.lang.String grouping, @Nullable java.lang.String groupingInstance, @NotNull @NotNull org.springframework.data.domain.Pageable page)
id
- id for jobname
- name of jobuser
- user who submitted jobstatuses
- statuses of jobtags
- tags for the jobclusterName
- name of cluster for jobclusterId
- id of cluster for jobcommandName
- name of the command run in the jobcommandId
- id of the command run in the jobminStarted
- 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 job grouping to search forgroupingInstance
- The job grouping instance to search forpage
- Page information of job to getlong deleteJobsCreatedBefore(@NotNull @NotNull java.time.Instant creationThreshold, @NotNull @NotNull java.util.Set<JobStatus> excludeStatuses, @Min(value=1L) @Min(value=1L) int batchSize)
creationThreshold
- The instant in time before which all jobs should be deletedexcludeStatuses
- The set of statuses that should be excluded from deletion if a job is in one of these
statusesbatchSize
- The maximum number of jobs that should be deleted per query@Nonnull java.lang.String saveJobSubmission(@Valid @Valid JobSubmission jobSubmission) throws IdAlreadyExistsException
The job record will be created with initial state of JobStatus.RESERVED
meaning that the unique id
returned by this API has been reserved within Genie and no other job can use it. If
JobSubmission
contains some attachments these attachments will be persisted to a
configured storage system (i.e. local disk, S3, etc) and added to the set of dependencies for the job.
The underlying attachment storage system must be accessible by the agent process configured by the system. For
example if the server is set up to write attachments to local disk but the agent is not running locally but
instead on the remote system it will not be able to access those attachments (as dependencies) and fail.
See AttachmentService
for more information.
jobSubmission
- All the information the system has gathered regarding the job submission from the user
either via the API or via the agent CLIIdAlreadyExistsException
- If the id the user requested already exists in the system for another jobJobRequest getJobRequest(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The unique id of the job to getNotFoundException
- If no job with id
existsvoid saveResolvedJob(@NotBlank @NotBlank java.lang.String id, @Valid @Valid ResolvedJob resolvedJob) throws NotFoundException
JobStatus.RESOLVED
.id
- The id of the jobresolvedJob
- The resolved information for the jobNotFoundException
- When the job identified by id
can't be found and the
specification can't be saved or one of the resolved cluster, command
or applications not longer exist in the system.java.util.Optional<JobSpecification> getJobSpecification(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
Optional
will be returned.id
- The id of the jobJobSpecification
if one is present else an empty Optional
NotFoundException
- If no job with id
existsvoid claimJob(@NotBlank @NotBlank java.lang.String id, @Valid @Valid AgentClientMetadata agentClientMetadata) throws NotFoundException, GenieJobAlreadyClaimedException, GenieInvalidStatusException
id
to be owned by the agent identified by agentClientMetadata
. The
job status in the system will be set to JobStatus.CLAIMED
id
- The id of the job to claim. Must exist in the system.agentClientMetadata
- The metadata about the client claiming the jobNotFoundException
- if no job with the given id
existsGenieJobAlreadyClaimedException
- if the job with the given id
already has been claimedGenieInvalidStatusException
- if the current job status is not JobStatus.RESOLVED
void updateJobStatus(@NotBlank @NotBlank java.lang.String id, @NotNull @NotNull JobStatus currentStatus, @NotNull @NotNull JobStatus newStatus, @Nullable java.lang.String newStatusMessage) throws NotFoundException, GenieInvalidStatusException
id
to be newStatus
provided that the current status
of the job matches newStatus
. Optionally a status message can be provided to provide more details to
users. If the newStatus
is JobStatus.RUNNING
the start time will be set. If the newStatus
is a member of JobStatus.getFinishedStatuses()
and the job had a started time set the finished time of
the job will be set.id
- The id of the job to update status for. Must exist in the system.currentStatus
- The status the caller to this API thinks the job currently hasnewStatus
- The new status the caller would like to update the status tonewStatusMessage
- An optional status message to associate with this changeNotFoundException
- if no job with the given id
existsGenieInvalidStatusException
- if the current status of the job identified by id
in the system
doesn't match the supplied currentStatus
.
Also if the currentStatus
equals the newStatus
.void updateJobArchiveStatus(@NotBlank(message="No job id entered. Unable to update.") @NotBlank(message="No job id entered. Unable to update.") java.lang.String id, @NotNull(message="Status cannot be null.") @NotNull(message="Status cannot be null.") ArchiveStatus archiveStatus) throws NotFoundException
id
- The id of the job to update the status for.archiveStatus
- The updated archive status for the job.NotFoundException
- If no job with the given id
existsJobStatus getJobStatus(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
.id
- The id of the job to get status forNotFoundException
- If no job with the given id
existsArchiveStatus getJobArchiveStatus(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
.id
- The id of the job to get status forNotFoundException
- If no job with the given id
existsjava.util.Optional<java.lang.String> getJobArchiveLocation(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the location forOptional.empty()
NotFoundException
- When there is no job with id id
FinishedJob getFinishedJob(@NotBlank @NotBlank java.lang.String id) throws NotFoundException, GenieInvalidStatusException
id
- The id of the job to retrieveNotFoundException
- if no job with the given id
existsGenieInvalidStatusException
- if the current status of the job is not finalboolean isApiJob(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job. Not blank.NotFoundException
- If no job with id existsCluster getJobCluster(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the cluster forCluster
NotFoundException
- If either the job or the cluster is not foundCommand getJobCommand(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the command forCommand
NotFoundException
- If either the job or the command is not foundjava.util.List<Application> getJobApplications(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the applications forApplication
sNotFoundException
- If either the job or the applications were not foundlong getActiveJobCountForUser(@NotBlank @NotBlank java.lang.String user)
user
- The user namejava.util.Map<java.lang.String,UserResourcesSummary> getUserResourcesSummaries(java.util.Set<JobStatus> statuses, boolean api)
statuses
- The set of JobStatus
a job must be in to be considered in this requestapi
- Whether the job was submitted via the api (true) or the agent cli (false)long getUsedMemoryOnHost(@NotBlank @NotBlank java.lang.String hostname)
hostname
- The hostname to get the memory forjava.util.Set<java.lang.String> getActiveJobs()
java.util.Set<java.lang.String> getUnclaimedJobs()
JobInfoAggregate getHostJobInformation(@NotBlank @NotBlank java.lang.String hostname)
hostname
- The hostname the agent is running the job onJobInfoAggregate
containing the metadata informationjava.util.Set<java.lang.String> getJobsWithStatusAndArchiveStatusUpdatedBefore(@NotEmpty @NotEmpty java.util.Set<JobStatus> statuses, @NotEmpty @NotEmpty java.util.Set<ArchiveStatus> archiveStatuses, @NotNull @NotNull java.time.Instant updated)
statuses
and archive status is in
archiveStatuses
and last updated before updated
.statuses
- the set of job statusesarchiveStatuses
- the set of job archive statusesupdated
- the threshold of last updatevoid updateRequestedLauncherExt(@NotBlank(message="No job id entered. Unable to update.") @NotBlank(message="No job id entered. Unable to update.") java.lang.String id, @NotNull(message="Status cannot be null.") @NotNull(message="Status cannot be null.") com.fasterxml.jackson.databind.JsonNode launcherExtension) throws NotFoundException
id
- The id of the job to update the laucher extension for.launcherExtension
- The updated requested launcher extension JSON blob.NotFoundException
- If no job with the given id
existscom.fasterxml.jackson.databind.JsonNode getRequestedLauncherExt(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the command forJsonNode
passed to the launcher at launch, or a
NullNode
if none was savedNotFoundException
- If no job with the given id
existsvoid updateLauncherExt(@NotBlank(message="No job id entered. Unable to update.") @NotBlank(message="No job id entered. Unable to update.") java.lang.String id, @NotNull(message="Status cannot be null.") @NotNull(message="Status cannot be null.") com.fasterxml.jackson.databind.JsonNode launcherExtension) throws NotFoundException
id
- The id of the job to update the launcher extension for.launcherExtension
- The updated launcher extension JSON blob.NotFoundException
- If no job with the given id
existscom.fasterxml.jackson.databind.JsonNode getLauncherExt(@NotBlank @NotBlank java.lang.String id) throws NotFoundException
id
- The id of the job to get the command forJsonNode
emitted by the launcher at launchNotFoundException
- If no job with the given id
exists<R extends CommonResource> void addConfigsToResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> configs, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the configs should be associated withid
- The id of the resource to add the configuration file to. Not null/empty/blank.configs
- The configuration files to add. Max file length is 1024 characters.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> java.util.Set<java.lang.String> getConfigsForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the configs are associated withid
- The id of the resource to get the configuration files for. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void updateConfigsForResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> configs, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the configs should be associated withid
- The id of the resource to update the configuration files for. Not null/empty/blank.configs
- The configuration files to replace existing configurations with. Not null/empty.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeAllConfigsForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the configs should be associated withid
- The id of the resource to remove the configuration file from. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeConfigForResource(@NotBlank @NotBlank java.lang.String id, @NotBlank @NotBlank java.lang.String config, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the configs should be associated withid
- The id of the resource to remove the configuration file from. Not null/empty/blank.config
- The configuration file to remove. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void addDependenciesToResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> dependencies, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the dependencies should be associated withid
- The id of the resource to add the dependency file to. Not null/empty/blank.dependencies
- The dependency files to add. Max file length is 1024 characters.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> java.util.Set<java.lang.String> getDependenciesForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the dependencies are associated withid
- The id of the resource to get the dependency files for. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void updateDependenciesForResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> dependencies, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the dependencies should be associated withid
- The id of the resource to update the dependency files for. Not null/empty/blank.dependencies
- The dependency files to replace existing dependencys with. Not null/empty.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeAllDependenciesForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the dependencies should be associated withid
- The id of the resource to remove the dependency file from. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeDependencyForResource(@NotBlank @NotBlank java.lang.String id, @NotBlank @NotBlank java.lang.String dependency, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the dependencies should be associated withid
- The id of the resource to remove the dependency file from. Not null/empty/blank.dependency
- The dependency file to remove. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void addTagsToResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> tags, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the tags should be associated withid
- The id of the resource to add the tags to. Not null/empty/blank.tags
- The tags to add. Max file length is 255 characters.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> java.util.Set<java.lang.String> getTagsForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the tags are associated withid
- The id of the resource to get the tags for. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void updateTagsForResource(@NotBlank @NotBlank java.lang.String id, java.util.Set<java.lang.String> tags, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the tags should be associated withid
- The id of the resource to update the tags for. Not null/empty/blank.tags
- The tags to replace existing tags with. Not null/empty.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeAllTagsForResource(@NotBlank @NotBlank java.lang.String id, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the tags should be associated withid
- The id of the resource to remove the tags from. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id exists<R extends CommonResource> void removeTagForResource(@NotBlank @NotBlank java.lang.String id, @NotBlank @NotBlank java.lang.String tag, java.lang.Class<R> resourceClass) throws NotFoundException
R
- The resource type that the tag should be associated withid
- The id of the resource to remove the tag from. Not null/empty/blank.tag
- The tag to remove. Not null/empty/blank.resourceClass
- The class of the resourceNotFoundException
- If no resource of type R
with id existslong deleteUnusedTags(@NotNull @NotNull java.time.Instant createdThreshold, @Min(value=1L) @Min(value=1L) int batchSize)
createdThreshold
- The instant in time where tags created before this time that aren't referenced
will be deleted. InclusivebatchSize
- The maximum number of tags to delete in a single transactionlong deleteUnusedFiles(@NotNull @NotNull java.time.Instant createdThreshold, @Min(value=1L) @Min(value=1L) int batchSize)
createdThreshold
- The instant in time where files created before this time that aren't referenced
will be deleted. InclusivebatchSize
- The maximum number of files to delete in a single transaction