RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Member Functions | List of all members
rstudio::launcher_plugins::quickstart::QuickStartJobSource Class Reference

Class which is responsible for running and retrieving information about jobs in the job scheduling system. More...

#include <QuickStartJobSource.hpp>

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

Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from rstudio::launcher_plugins::api::IJobSource
 IJobSource (jobs::JobRepositoryPtr in_jobRepository, jobs::JobStatusNotifierPtr in_jobStatusNotifier)
 Constructor. More...
 
- Protected Attributes inherited from rstudio::launcher_plugins::api::IJobSource
jobs::JobRepositoryPtr m_jobRepository
 
jobs::JobStatusNotifierPtr m_jobStatusNotifier
 

Detailed Description

Class which is responsible for running and retrieving information about jobs in the job scheduling system.

Constructor & Destructor Documentation

◆ QuickStartJobSource()

rstudio::launcher_plugins::quickstart::QuickStartJobSource::QuickStartJobSource ( const jobs::JobRepositoryPtr &  in_jobRepository,
const jobs::JobStatusNotifierPtr &  in_jobStatusNotifier 
)

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()

bool rstudio::launcher_plugins::quickstart::QuickStartJobSource::cancelJob ( api::JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ createOutputStream()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::createOutputStream ( api::OutputType  in_outputType,
api::JobPtr  in_job,
api::AbstractOutputStream::OnOutput  in_onOutput,
api::AbstractOutputStream::OnComplete  in_onComplete,
api::AbstractOutputStream::OnError  in_onError,
api::OutputStreamPtr &  out_outputStream 
)
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ createResourceStream()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::createResourceStream ( api::ConstJobPtr  in_job,
comms::AbstractLauncherCommunicatorPtr  in_launcherCommunicator,
api::AbstractResourceStreamPtr &  out_resourceStream 
)
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ getConfiguration()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::getConfiguration ( const system::User in_user,
api::JobSourceConfiguration out_configuration 
) const
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ getNetworkInfo()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::getNetworkInfo ( api::JobPtr  in_job,
api::NetworkInfo out_networkInfo 
) const
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ initialize()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::initialize ( )
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ killJob()

bool rstudio::launcher_plugins::quickstart::QuickStartJobSource::killJob ( api::JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ resumeJob()

bool rstudio::launcher_plugins::quickstart::QuickStartJobSource::resumeJob ( api::JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
overridevirtual

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 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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ stopJob()

bool rstudio::launcher_plugins::quickstart::QuickStartJobSource::stopJob ( api::JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
overridevirtual

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 canceled.
out_statusMessageThe status message of the cancel operation, if any.
Returns
True if the job was stopped; false otherwise.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ submitJob()

Error rstudio::launcher_plugins::quickstart::QuickStartJobSource::submitJob ( api::JobPtr  io_job,
bool &  out_wasInvalidRequest 
) const
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.

◆ suspendJob()

bool rstudio::launcher_plugins::quickstart::QuickStartJobSource::suspendJob ( api::JobPtr  in_job,
bool &  out_isComplete,
std::string &  out_statusMessage 
)
overridevirtual

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.

Implements rstudio::launcher_plugins::api::IJobSource.


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