Class which is responsible for running and retrieving information about jobs on the Local system.
More...
#include <LocalJobSource.hpp>
|
| 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...
|
|
virtual | ~IJobSource ()=default |
| Virtual Destructor.
|
|
Class which is responsible for running and retrieving information about jobs on the Local system.
◆ LocalJobSource()
rstudio::launcher_plugins::local::LocalJobSource::LocalJobSource |
( |
std::string |
in_hostname, |
|
|
jobs::JobStatusNotifierPtr |
in_jobStatusNotifier, |
|
|
std::shared_ptr< LocalJobRepository > |
in_jobRepository |
|
) |
| |
Constructor.
- Parameters
-
in_hostname | The name of the host running this instance of the Local Plugin. |
in_jobStatusNotifier | The job status notifier to which to post or from which to receive job status updates. |
in_jobRepository | The job repository, from which to look up jobs. |
◆ 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_job | The job to be canceled. |
out_isComplete | Whether the cancel operation completed successfully (true) or not (false). |
out_statusMessage | The 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_outputType | The type of job output to stream. |
in_job | The job for which output should be streamed. |
in_onOutput | Callback function which will be invoked when data is reported. |
in_onComplete | Callback function which will be invoked when the stream is complete. |
in_onError | Callback function which will be invoked if an error occurs. |
out_outputStream | The 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_job | The job for which resource utilization metrics should be streamed. |
in_launcherCommunicator | The communicator with which to send responses to the Launcher. |
out_resourceStream | The 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()
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_configuration | The 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_job | The job for which to retrieve network information. |
out_networkInfo | The 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_job | The job to be canceled. |
out_isComplete | Whether the kill operation completed successfully (true) or not (false). |
out_statusMessage | The 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_job | The job to be canceled. |
out_isComplete | Whether the resume operation completed successfully (true) or not (false). |
out_statusMessage | The 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_job | The job to be canceled. |
out_isComplete | Whether the stop operation completed successfully (true) or not (false). |
out_statusMessage | The 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_job | The Job to be submitted. |
out_wasInvalidRequest | Whether 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_job | The job to be suspended. |
out_isComplete | Whether the suspend operation completed successfully (true) or not (false). |
out_statusMessage | The 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:
- /var/lib/jenkins/workspace/IDE/launcher-plugin-sdk/master/plugins/Local/include/LocalJobSource.hpp