RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rstudio::launcher_plugins::api::IJobSource Class Referenceabstract

Generic interface for communicating with a Job Source. Implementation is plugin specific. More...

#include <IJobSource.hpp>

Inheritance diagram for rstudio::launcher_plugins::api::IJobSource:
rstudio::launcher_plugins::local::LocalJobSource rstudio::launcher_plugins::quickstart::QuickStartJobSource

Public Member Functions

virtual ~IJobSource ()=default
 Virtual Destructor.
 
virtual Error initialize ()=0
 Initializes the Job Source. More...
 
virtual bool cancelJob (JobPtr in_job, bool &out_isComplete, std::string &out_statusMessage)=0
 Cancels a pending job. More...
 
virtual Error getConfiguration (const system::User &in_user, JobSourceConfiguration &out_configuration) const =0
 Gets the configuration and capabilities of this Job Source for the specified user. More...
 
virtual Error getNetworkInfo (JobPtr in_job, NetworkInfo &out_networkInfo) const =0
 Gets the network information for the specified job. More...
 
virtual bool killJob (JobPtr in_job, bool &out_isComplete, std::string &out_statusMessage)=0
 Forcibly kills a running job. More...
 
virtual bool resumeJob (JobPtr in_job, bool &out_isComplete, std::string &out_statusMessage)=0
 Resumes a suspended job. More...
 
virtual bool stopJob (JobPtr in_job, bool &out_isComplete, std::string &out_statusMessage)=0
 Stops a running job. More...
 
virtual bool suspendJob (JobPtr in_job, bool &out_isComplete, std::string &out_statusMessage)=0
 Suspends a running job. More...
 
virtual Error submitJob (JobPtr io_job, bool &out_wasInvalidRequest) const =0
 Submits a job to the Job Scheduling System. More...
 
virtual Error createOutputStream (OutputType in_outputType, JobPtr in_job, AbstractOutputStream::OnOutput in_onOutput, AbstractOutputStream::OnComplete in_onComplete, AbstractOutputStream::OnError in_onError, OutputStreamPtr &out_outputStream)=0
 Creates an output stream for the specified job. More...
 
virtual Error createResourceStream (ConstJobPtr in_job, comms::AbstractLauncherCommunicatorPtr in_launcherCommunicator, AbstractResourceStreamPtr &out_resourceStream)=0
 Creates a resource utilization metric stream for the specified job. More...
 

Protected Member Functions

 IJobSource (jobs::JobRepositoryPtr in_jobRepository, jobs::JobStatusNotifierPtr in_jobStatusNotifier)
 Constructor. More...
 

Protected Attributes

jobs::JobRepositoryPtr m_jobRepository
 
jobs::JobStatusNotifierPtr m_jobStatusNotifier
 

Detailed Description

Generic interface for communicating with a Job Source. Implementation is plugin specific.

Constructor & Destructor Documentation

◆ IJobSource()

rstudio::launcher_plugins::api::IJobSource::IJobSource ( jobs::JobRepositoryPtr  in_jobRepository,
jobs::JobStatusNotifierPtr  in_jobStatusNotifier 
)
inlineprotected

Constructor.

Parameters
in_jobRepositoryThe job repository, from which to look up jobs.
in_jobStatusNotifierThe job status notifier to which to post or from which to receive job status updates.

Member Function Documentation

◆ cancelJob()

virtual bool rstudio::launcher_plugins::api::IJobSource::cancelJob ( JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
pure virtual

Cancels a pending job.

This method will not be invoked unless the job is currently pending. The Job lock will be held when this method is invoked.

Parameters
in_jobThe job to be canceled.
out_isCompleteWhether the cancel operation completed successfully (true) or not (false).
out_statusMessageThe status message of the cancel operation, if any.
Returns
False if the cancel operation is not supported; true otherwise.

Implemented in rstudio::launcher_plugins::local::LocalJobSource, and rstudio::launcher_plugins::quickstart::QuickStartJobSource.

◆ createOutputStream()

virtual Error rstudio::launcher_plugins::api::IJobSource::createOutputStream ( OutputType  in_outputType,
JobPtr  in_job,
AbstractOutputStream::OnOutput  in_onOutput,
AbstractOutputStream::OnComplete  in_onComplete,
AbstractOutputStream::OnError  in_onError,
OutputStreamPtr &  out_outputStream 
)
pure virtual

Creates an output stream for the specified job.

Parameters
in_outputTypeThe type of job output to stream.
in_jobThe job for which output should be streamed.
in_onOutputCallback function which will be invoked when data is reported.
in_onCompleteCallback function which will be invoked when the stream is complete.
in_onErrorCallback function which will be invoked if an error occurs.
out_outputStreamThe newly created output stream, on Success.
Returns
Success if the output stream could be created; Error otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ createResourceStream()

virtual Error rstudio::launcher_plugins::api::IJobSource::createResourceStream ( ConstJobPtr  in_job,
comms::AbstractLauncherCommunicatorPtr  in_launcherCommunicator,
AbstractResourceStreamPtr &  out_resourceStream 
)
pure virtual

Creates a resource utilization metric stream for the specified job.

Parameters
in_jobThe job for which resource utilization metrics should be streamed.
in_launcherCommunicatorThe communicator with which to send responses to the Launcher.
out_resourceStreamThe newly created resource utilization metric stream, on Success.
Returns
Sucess if the stream could be created; the Error that occurred otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ getConfiguration()

virtual Error rstudio::launcher_plugins::api::IJobSource::getConfiguration ( const system::User in_user,
JobSourceConfiguration out_configuration 
) const
pure virtual

Gets the configuration and capabilities of this Job Source for the specified user.

This function controls the options that will be available to users when launching jobs.

NOTE: Many of the values here should most likely be controllable by Launcher administrators when they configure the Launcher. For more details, see the RStudio Launcher Plugin SDK QuickStart Guide TODO #7.

Parameters
in_userThe user who made the request to see the configuration and capabilities of the Cluster. This may be used to return a different configuration based on any configured user profiles. For more information about user profiles, see the 'User Profiles' subsection of the 'Advanced Features' section of the RStudio Launcher Plugin SDK Developer's Guide.
out_configurationThe configuration and capabilities of this Job Source, for the specified user.
Returns
Success if the configuration and capabilities for this Job Source could be populated; Error otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ getNetworkInfo()

virtual Error rstudio::launcher_plugins::api::IJobSource::getNetworkInfo ( JobPtr  in_job,
NetworkInfo out_networkInfo 
) const
pure virtual

Gets the network information for the specified job.

Parameters
in_jobThe job for which to retrieve network information.
out_networkInfoThe network information of the specified job, if no error occurred.
Returns
Success if the network information could be retrieved; Error otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ initialize()

virtual Error rstudio::launcher_plugins::api::IJobSource::initialize ( )
pure virtual

Initializes the Job Source.

This function should return an error if communication with the job source fails.

Returns
Success if the job source could be initialized; Error otherwise.

Implemented in rstudio::launcher_plugins::local::LocalJobSource, and rstudio::launcher_plugins::quickstart::QuickStartJobSource.

◆ killJob()

virtual bool rstudio::launcher_plugins::api::IJobSource::killJob ( JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
pure virtual

Forcibly kills a running job.

This method should perform the equivalent of sending a SIGKILL to a process. This method will not be invoked unless the job is currently running. The Job lock will be held when this method is invoked.

Parameters
in_jobThe job to be killed.
out_isCompleteWhether the kill operation completed successfully (true) or not (false).
out_statusMessageThe status message of the kill operation, if any.
Returns
False if the kill operation is not supported; true otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ resumeJob()

virtual bool rstudio::launcher_plugins::api::IJobSource::resumeJob ( JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
pure virtual

Resumes a suspended job.

This method should perform the equivalent of sending a SIGCONT to a process. This method will not be invoked unless the job is currently suspended. The Job lock will be held when this method is invoked.

Parameters
in_jobThe job to be resumed.
out_isCompleteWhether the resume operation completed successfully (true) or not (false).
out_statusMessageThe status message of the resume operation, if any.
Returns
False if the resume operation is not supported; true otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ stopJob()

virtual bool rstudio::launcher_plugins::api::IJobSource::stopJob ( JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
pure virtual

Stops a running job.

This method should perform the equivalent of sending a SIGTERM to a process. This method will not be invoked unless the job is currently running. The Job lock will be held when this method is invoked.

Parameters
in_jobThe job to be stopped.
out_isCompleteWhether the stop operation completed successfully (true) or not (false).
out_statusMessageThe status message of the stop operation, if any.
Returns
False if the stop operation is not supported; true otherwise.

Implemented in rstudio::launcher_plugins::local::LocalJobSource, and rstudio::launcher_plugins::quickstart::QuickStartJobSource.

◆ submitJob()

virtual Error rstudio::launcher_plugins::api::IJobSource::submitJob ( JobPtr  io_job,
bool &  out_wasInvalidRequest 
) const
pure virtual

Submits a job to the Job Scheduling System.

Parameters
io_jobThe Job to be submitted. On successful submission, the Job should be updated with relevant details, such as the ID of the job, the Submission time, the actual Job Queue (if applicable), and the current status.
out_wasInvalidRequestWhether the requested Job was invalid, based on the features supported by the Job Scheduling System.
Returns
Success if the job could be submitted to the Job Scheduling System; Error otherwise.

Implemented in rstudio::launcher_plugins::quickstart::QuickStartJobSource, and rstudio::launcher_plugins::local::LocalJobSource.

◆ suspendJob()

virtual bool rstudio::launcher_plugins::api::IJobSource::suspendJob ( JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
pure virtual

Suspends a running job.

This method should perform the equivalent of sending a SIGSTOP to a process. A suspended job should be able to be resumed at a later time. This method will not be invoked unless the job is currently running. The Job lock will be held when this method is invoked.

Parameters
in_jobThe job to be suspended.
out_isCompleteWhether the suspend operation completed successfully (true) or not (false).
out_statusMessageThe status message of the suspend operation, if any.
Returns
False if the suspend operation is not supported; true otherwise.

Implemented in rstudio::launcher_plugins::local::LocalJobSource, and rstudio::launcher_plugins::quickstart::QuickStartJobSource.

Member Data Documentation

◆ m_jobRepository

jobs::JobRepositoryPtr rstudio::launcher_plugins::api::IJobSource::m_jobRepository
protected

The job repository, from which to look up jobs.

◆ m_jobStatusNotifier

jobs::JobStatusNotifierPtr rstudio::launcher_plugins::api::IJobSource::m_jobStatusNotifier
protected

The job status notifier to which to post or from which to receive job status updates.


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