All Implemented Interfaces:
AuditProjection, BaseProjection, IdProjection, SetupFileProjection, UniqueIdProjection, Serializable

@Entity public class CommandEntity extends BaseEntity
Representation of the state of the Command Object.
See Also:
  • Field Details

    • APPLICATIONS_ENTITY_GRAPH

      public static final String APPLICATIONS_ENTITY_GRAPH
      The name of the EntityGraph which will eagerly load the command base fields and its associated applications base fields.
      See Also:
    • APPLICATIONS_DTO_ENTITY_GRAPH

      public static final String APPLICATIONS_DTO_ENTITY_GRAPH
      The name of the EntityGraph which will eagerly load the command base fields and its associated applications dto fields.
      See Also:
    • CLUSTER_CRITERIA_ENTITY_GRAPH

      public static final String CLUSTER_CRITERIA_ENTITY_GRAPH
      The name of the EntityGraph which will eagerly load the command base fields and its associated cluster criteria.
      See Also:
    • DTO_ENTITY_GRAPH

      public static final String DTO_ENTITY_GRAPH
      The name of the EntityGraph which will eagerly load everything needed to construct a Command DTO.
      See Also:
  • Constructor Details

    • CommandEntity

      public CommandEntity()
      Default Constructor.
  • Method Details

    • setExecutable

      public void setExecutable(@NotEmpty @NotEmpty List<@NotBlank @Size(max=1024) String> executable)
      Set the executable and any default arguments for this command.
      Parameters:
      executable - The executable and default arguments which can't be blank and there must be at least one
    • setConfigs

      public void setConfigs(@Nullable Set<FileEntity> configs)
      Set all the files associated as configuration files for this cluster.
      Parameters:
      configs - The configuration files to set
    • setDependencies

      public void setDependencies(@Nullable Set<FileEntity> dependencies)
      Set all the files associated as dependency files for this cluster.
      Parameters:
      dependencies - The dependency files to set
    • setTags

      public void setTags(@Nullable Set<TagEntity> tags)
      Set all the tags associated to this cluster.
      Parameters:
      tags - The dependency tags to set
    • getCpu

      public Optional<Integer> getCpu()
      Get the default number of CPUs for a job using this command.
      Returns:
      The number of CPUs or Optional.empty()
    • getGpu

      public Optional<Integer> getGpu()
      Get the default number of GPUs for a job using this command.
      Returns:
      The number of GPUs or Optional.empty()
    • getMemory

      public Optional<Long> getMemory()
      Get the default memory for a job using this command.
      Returns:
      Optional of Integer as it could be null
    • getDiskMb

      public Optional<Long> getDiskMb()
      Get the default amount of disk space for the job using this command in MB.
      Returns:
      The amount of disk space in MB or Optional.empty()
    • getNetworkMbps

      public Optional<Long> getNetworkMbps()
      Get the default amount of network bandwidth to allocate to the job using this command in mbps.
      Returns:
      The amount of network bandwidth in mbps or Optional.empty()
    • getImages

      public Optional<com.fasterxml.jackson.databind.JsonNode> getImages()
      Get the default set of images to run this job with if this command is selected.
      Returns:
      The default set of images or Optional.empty()
    • getLauncherExt

      public Optional<com.fasterxml.jackson.databind.JsonNode> getLauncherExt()
      Get any metadata associated with this command pertaining to specifying details for various agent launchers.
      Returns:
      The metadata or Optional.empty() if there isn't any
    • setLauncherExt

      public void setLauncherExt(@Nullable com.fasterxml.jackson.databind.JsonNode launcherExt)
      Set any metadata pertaining to additional instructions for various launchers if this command is used.
      Parameters:
      launcherExt - The metadata
    • setApplications

      public void setApplications(@Nullable List<ApplicationEntity> applications) throws PreconditionFailedException
      Sets the applications for this command.
      Parameters:
      applications - The application that this command uses
      Throws:
      PreconditionFailedException - if the list of applications contains duplicates
    • addApplication

      public void addApplication(@NotNull @NotNull ApplicationEntity application) throws PreconditionFailedException
      Append an application to the list of applications this command uses.
      Parameters:
      application - The application to add. Not null.
      Throws:
      PreconditionFailedException - If the application is a duplicate of an existing application
    • removeApplication

      public void removeApplication(@NotNull @NotNull ApplicationEntity application)
      Remove an application from this command. Manages both sides of relationship.
      Parameters:
      application - The application to remove. Not null.
    • setClusterCriteria

      public void setClusterCriteria(@Nullable List<CriterionEntity> clusterCriteria)
      Set the criteria, in priority order, that this command has for determining which available clusters to use for a job.
      Parameters:
      clusterCriteria - The cluster criteria
    • addClusterCriterion

      public void addClusterCriterion(CriterionEntity criterion)
      Add a new cluster criterion as the lowest priority criterion to evaluate for this command.
      Parameters:
      criterion - The CriterionEntity to add
    • addClusterCriterion

      public void addClusterCriterion(CriterionEntity criterion, int priority)
      Add a new cluster criterion with the given priority.
      Parameters:
      criterion - The new criterion to add
      priority - The priority with which this criterion should be considered. 0 would be the highest priority and anything greater than the current size of the existing criteria will just be added to the end of the list. If a priority of < 0 is passed in the criterion is added as the highest priority (0).
    • removeClusterCriterion

      public CriterionEntity removeClusterCriterion(int priority) throws IllegalArgumentException
      Remove the criterion with the given priority from the list of available criterion for this command.
      Parameters:
      priority - The priority of the criterion to remove.
      Returns:
      The CriterionEntity which was removed by this operation
      Throws:
      IllegalArgumentException - If this value is < 0 or > {@link List#size()} as it becomes unclear what the user wants to do
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BaseEntity
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BaseEntity