RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
rstudio::launcher_plugins::api::Job Struct Reference

Structure which represents a job. More...

#include <Job.hpp>

Public Types

enum  State {
  State::CANCELED, State::FAILED, State::FINISHED, State::KILLED,
  State::PENDING, State::RUNNING, State::SUSPENDED, State::UNKNOWN
}
 

Public Member Functions

 Job ()
 Constructor.
 
 Job (const Job &in_other)
 Copy constructor. More...
 
 Job (Job &&in_other) noexcept
 Move constructor. More...
 
Joboperator= (const Job &in_other)
 Assignment operator. More...
 
Joboperator= (Job &&in_other) noexcept
 Move operator. More...
 
Optional< std::string > getJobConfigValue (const std::string &in_name) const
 Gets a job configuration value, if it exists. More...
 
bool isCompleted () const
 Checks whether the job has completed (i.e. the job's state is a completed state). More...
 
bool matchesTags (const std::set< std::string > &in_tags) const
 Checks whether the job has all of the supplied tags. More...
 
json::Object toJson () const
 Converts this Job to a JSON object which represents it. More...
 

Static Public Member Functions

static Error fromJson (const json::Object &in_json, Job &out_job)
 Constructs a Job from a JSON object which represents the job. More...
 
static Error stateFromString (const std::string &in_statusString, State &out_status)
 Converts a status string into its equivalent Job::State enum value. More...
 
static std::string stateToString (State in_status)
 Converts a Job::State enum value into its string representation. More...
 

Public Attributes

std::vector< std::string > Arguments
 
std::string Cluster
 
std::string Command
 The shell command to run. More...
 
JobConfigList Config
 
Optional< ContainerContainerDetails
 
EnvironmentList Environment
 
std::string Exe
 The executable to run. More...
 
Optional< int > ExitCode
 
ExposedPortList ExposedPorts
 
std::string Host
 
std::string Id
 
Optional< system::DateTimeLastUpdateTime
 
MountList Mounts
 
std::string Name
 
Optional< pid_t > Pid
 
PlacementConstraintList PlacementConstraints
 
std::set< std::string > Queues
 
ResourceLimitList ResourceLimits
 
std::string StandardIn
 
std::string StandardErrFile
 
std::string StandardOutFile
 
State Status
 
std::string StatusMessage
 
system::DateTime SubmissionTime
 
std::set< std::string > Tags
 
system::User User
 
std::string WorkingDirectory
 

Friends

class JobLock
 

Detailed Description

Structure which represents a job.

Member Enumeration Documentation

◆ State

Enumerator
CANCELED 

The job was canceled by the user.

FAILED 

The job failed to launch.

FINISHED 

The job finished running, successfully or not.

KILLED 

The job was killed.

PENDING 

The job is queued in the job scheduling system and has not started yet.

RUNNING 

The job is currently running.

SUSPENDED 

The job has been suspended.

UNKNOWN 

The job status is unknown.

Constructor & Destructor Documentation

◆ Job() [1/2]

rstudio::launcher_plugins::api::Job::Job ( const Job in_other)

Copy constructor.

Parameters
in_otherThe job to copy.

◆ Job() [2/2]

rstudio::launcher_plugins::api::Job::Job ( Job &&  in_other)
noexcept

Move constructor.

Parameters
in_otherThe job to move into this job.

Member Function Documentation

◆ fromJson()

static Error rstudio::launcher_plugins::api::Job::fromJson ( const json::Object in_json,
Job out_job 
)
static

Constructs a Job from a JSON object which represents the job.

Parameters
in_jsonThe JSON object which represents the job.
out_jobThe populated job value. Not valid if an error is returned.
Returns
Success if in_json could be parsed as a Job; Error otherwise.

◆ getJobConfigValue()

Optional<std::string> rstudio::launcher_plugins::api::Job::getJobConfigValue ( const std::string &  in_name) const

Gets a job configuration value, if it exists.

Parameters
in_nameThe name of the configuration option to retrieve.
Returns
The value of the configuration option, if any.

◆ isCompleted()

bool rstudio::launcher_plugins::api::Job::isCompleted ( ) const

Checks whether the job has completed (i.e. the job's state is a completed state).

Returns
True if the job has completed; false otherwise.

◆ matchesTags()

bool rstudio::launcher_plugins::api::Job::matchesTags ( const std::set< std::string > &  in_tags) const

Checks whether the job has all of the supplied tags.

Parameters
in_tagsThe desired set of tags to filter jobs by.
Returns
True if this job has all of the supplied tags; false otherwise.

◆ operator=() [1/2]

Job& rstudio::launcher_plugins::api::Job::operator= ( const Job in_other)

Assignment operator.

Parameters
in_otherThe Job to copy into this Job.
Returns
A reference to this Job.

◆ operator=() [2/2]

Job& rstudio::launcher_plugins::api::Job::operator= ( Job &&  in_other)
noexcept

Move operator.

Parameters
in_otherThe Job to move into this Job.
Returns
A reference to this Job.

◆ stateFromString()

static Error rstudio::launcher_plugins::api::Job::stateFromString ( const std::string &  in_statusString,
State out_status 
)
static

Converts a status string into its equivalent Job::State enum value.

Parameters
in_statusStringThe string to convert.
out_statusThe converted status, if no error occurred.
Returns
Success if in_statusString is a valid job state; Error otherwise.

◆ stateToString()

static std::string rstudio::launcher_plugins::api::Job::stateToString ( State  in_status)
static

Converts a Job::State enum value into its string representation.

Parameters
in_statusThe Job::State value to be converted to string.
Returns
The string representation of the specified Job::State.

◆ toJson()

json::Object rstudio::launcher_plugins::api::Job::toJson ( ) const

Converts this Job to a JSON object which represents it.

Returns
The JSON object which represents this Job.

Member Data Documentation

◆ Arguments

std::vector<std::string> rstudio::launcher_plugins::api::Job::Arguments

The arguments to supply to the Command or Exe.

◆ Cluster

std::string rstudio::launcher_plugins::api::Job::Cluster

The name of the cluster which should run this job.

◆ Command

std::string rstudio::launcher_plugins::api::Job::Command

The shell command to run.

This should be run using a shell such as /bin/sh, as opposed to Exe, which should be invoked directly.

Only one of Command and Exe may be set per job. Jobs which have both set should have been rejected by the Launcher.

◆ Config

JobConfigList rstudio::launcher_plugins::api::Job::Config

The custom job scheduling specific configuration options that were set by the user for this job.

◆ ContainerDetails

Optional<Container> rstudio::launcher_plugins::api::Job::ContainerDetails

The container to run the job in. Only used for containerized jobs.

◆ Environment

EnvironmentList rstudio::launcher_plugins::api::Job::Environment

Environment variables to set on the job's run environment.

◆ Exe

std::string rstudio::launcher_plugins::api::Job::Exe

The executable to run.

This should be invoked directly. It is the user's responsibility to ensure that the provided executable is either fully qualified or on the PATH within the job environment.

Only one of Command and Exe may be set per job. Jobs which have both set should have been rejected by the Launcher.

◆ ExitCode

Optional<int> rstudio::launcher_plugins::api::Job::ExitCode

The exit code of the job, if applicable.

◆ ExposedPorts

ExposedPortList rstudio::launcher_plugins::api::Job::ExposedPorts

The ports which were exposed for this job. Only used with containerized jobs.

◆ Host

std::string rstudio::launcher_plugins::api::Job::Host

The host on which the job was or is being run.

◆ Id

std::string rstudio::launcher_plugins::api::Job::Id

The unique ID of the job in the scheduling system.

◆ LastUpdateTime

Optional<system::DateTime> rstudio::launcher_plugins::api::Job::LastUpdateTime

The last time the job was updated.

◆ Mounts

MountList rstudio::launcher_plugins::api::Job::Mounts

The file system mounts to set when launching this job.

◆ Name

std::string rstudio::launcher_plugins::api::Job::Name

The name of the job.

◆ Pid

Optional<pid_t> rstudio::launcher_plugins::api::Job::Pid

The PID of the job, if applicable.

◆ PlacementConstraints

PlacementConstraintList rstudio::launcher_plugins::api::Job::PlacementConstraints

Custom placement constraints for the job scheduling system that were set by the user for this job.

◆ Queues

std::set<std::string> rstudio::launcher_plugins::api::Job::Queues

The set of queues on which this job may be run, or the queue which ran the job.

◆ ResourceLimits

ResourceLimitList rstudio::launcher_plugins::api::Job::ResourceLimits

The resource limits that were set by the user for this job.

◆ StandardErrFile

std::string rstudio::launcher_plugins::api::Job::StandardErrFile

The file to which the job's standard error output was written.

◆ StandardIn

std::string rstudio::launcher_plugins::api::Job::StandardIn

Data which should be supplied to the job via standard in.

◆ StandardOutFile

std::string rstudio::launcher_plugins::api::Job::StandardOutFile

The file to which the job's standard output was written.

◆ Status

State rstudio::launcher_plugins::api::Job::Status

The status of the job.

◆ StatusMessage

std::string rstudio::launcher_plugins::api::Job::StatusMessage

The reason for the status, if any.

◆ SubmissionTime

system::DateTime rstudio::launcher_plugins::api::Job::SubmissionTime

The time at which the job was submitted to the job scheduling system.

◆ Tags

std::set<std::string> rstudio::launcher_plugins::api::Job::Tags

The tags which were set on the job by the user. Can be used for filtering jobs based on tags.

◆ User

system::User rstudio::launcher_plugins::api::Job::User

The user who ran the job.

◆ WorkingDirectory

std::string rstudio::launcher_plugins::api::Job::WorkingDirectory

The working directory from which to run the job.


The documentation for this struct was generated from the following file: