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::local::LocalJobSource Class Reference

Class which is responsible for running and retrieving information about jobs on the Local system. More...

#include <LocalJobSource.hpp>

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

Public Member Functions

 LocalJobSource (std::string in_hostname, jobs::JobStatusNotifierPtr in_jobStatusNotifier, std::shared_ptr< LocalJobRepository > in_jobRepository)
 Constructor. More...
 
Error initialize () override
 Initializes the Local 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 &, api::JobSourceConfiguration &out_configuration) const override
 Gets the configuration and capabilities of the Local Job Source. 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
 Runs a job on the local instance. 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 a file 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 on the Local system.

Constructor & Destructor Documentation

◆ LocalJobSource()

rstudio::launcher_plugins::local::LocalJobSource::LocalJobSource ( std::string  in_hostname,
jobs::JobStatusNotifierPtr  in_jobStatusNotifier,
std::shared_ptr< LocalJobRepository in_jobRepository 
)

Constructor.

Parameters
in_hostnameThe name of the host running this instance of the Local Plugin.
in_jobStatusNotifierThe job status notifier to which to post or from which to receive job status updates.
in_jobRepositoryThe job repository, from which to look up jobs.

Member Function Documentation

◆ cancelJob()

bool rstudio::launcher_plugins::local::LocalJobSource::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::local::LocalJobSource::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 a file 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::local::LocalJobSource::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::local::LocalJobSource::getConfiguration ( const system::User ,
api::JobSourceConfiguration out_configuration 
) const
overridevirtual

Gets the configuration and capabilities of the Local Job Source.

The Local Job Source only has two custom configuration values. It does not support resource limits, placement constraints, queues, or containers.

Parameters
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::local::LocalJobSource::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::local::LocalJobSource::initialize ( )
overridevirtual

Initializes the Local Job Source.

This function initializes the file-based job storage and communications with other Local plugins which are part of this Launcher cluster.

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

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

◆ killJob()

bool rstudio::launcher_plugins::local::LocalJobSource::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 canceled.
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::local::LocalJobSource::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 canceled.
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.

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

◆ stopJob()

bool rstudio::launcher_plugins::local::LocalJobSource::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_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.

◆ submitJob()

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

Runs a job on the local instance.

Parameters
io_jobThe Job to be submitted.
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::local::LocalJobSource::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: