RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Job.hpp
1 /*
2  * Job.hpp
3  *
4  * Copyright (C) 2020 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant to the terms of a commercial license agreement
7  * with RStudio, then this program is licensed to you under the following terms:
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
10  * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
11  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 #ifndef LAUNCHER_PLUGINS_JOB_HPP
25 #define LAUNCHER_PLUGINS_JOB_HPP
26 
27 #include <ctime>
28 #include <set>
29 #include <string>
30 #include <vector>
31 
32 #include <Noncopyable.hpp>
33 #include <Optional.hpp>
34 #include <PImpl.hpp>
35 #include <json/Json.hpp>
36 #include <system/DateTime.hpp>
37 #include <system/User.hpp>
38 #include <utils/MutexUtils.hpp>
39 
40 namespace rstudio {
41 namespace launcher_plugins {
42 
43 class Error;
44 
45 } // namespace launcher_plugins
46 } // namespace rstudio
47 
48 namespace rstudio {
49 namespace launcher_plugins {
50 namespace api {
51 
52 
53 // Forward Declarations
54 struct AzureFileMountSource;
55 struct CephFsMountSource;
56 struct Container;
57 struct ExposedPort;
58 struct GlusterFsMountSource;
59 struct HostMountSource;
60 struct Job;
61 struct JobConfig;
62 class JobLock;
63 struct Mount;
64 struct MountSource;
65 struct NfsMountSource;
66 struct ResourceLimit;
67 struct PlacementConstraint;
68 
69 // Convenience Typedefs
70 typedef std::shared_ptr<Job> JobPtr;
71 typedef std::shared_ptr<const Job> ConstJobPtr;
72 
73 typedef std::pair<std::string, std::string> EnvVariable;
74 typedef std::vector<EnvVariable> EnvironmentList;
75 typedef std::vector<ExposedPort> ExposedPortList;
76 typedef std::vector<JobConfig> JobConfigList;
77 typedef std::vector<JobPtr> JobList;
78 typedef std::vector<Mount> MountList;
79 typedef std::vector<PlacementConstraint> PlacementConstraintList;
80 typedef std::vector<ResourceLimit> ResourceLimitList;
81 
83 struct Container
84 {
93  static Error fromJson(const json::Object& in_json, Container& out_container);
94 
100  json::Object toJson() const;
101 
103  std::string Image;
104 
107 
110 
112  std::vector<int> SupplementalGroupIds;
113 };
114 
117 {
126  static Error fromJson(const json::Object& in_json, ExposedPort& out_exposedPort);
127 
133  json::Object toJson() const;
134 
137 
139  std::string Protocol;
140 
143 };
144 
146 struct Job
147 {
153  enum class State
154  {
156  CANCELED,
157 
159  FAILED,
160 
162  FINISHED,
163 
165  KILLED,
166 
168  PENDING,
169 
171  RUNNING,
172 
174  SUSPENDED,
175 
177  UNKNOWN
178  };
179 
183  Job();
184 
190  Job(const Job& in_other);
191 
197  Job(Job&& in_other) noexcept;
198 
207  static Error fromJson(const json::Object& in_json, Job& out_job);
208 
217  static Error stateFromString(const std::string& in_statusString, State& out_status);
218 
226  static std::string stateToString(State in_status);
227 
235  Job& operator=(const Job& in_other);
236 
244  Job& operator=(Job&& in_other) noexcept;
245 
253  Optional<std::string> getJobConfigValue(const std::string& in_name) const;
254 
260  bool isCompleted() const;
261 
269  bool matchesTags(const std::set<std::string>& in_tags) const;
270 
276  json::Object toJson() const;
277 
279  std::vector<std::string> Arguments;
280 
282  std::string Cluster;
283 
292  std::string Command;
293 
295  JobConfigList Config;
296 
299 
301  EnvironmentList Environment;
302 
312  std::string Exe;
313 
316 
318  ExposedPortList ExposedPorts;
319 
321  std::string Host;
322 
324  std::string Id;
325 
328 
330  MountList Mounts;
331 
333  std::string Name;
334 
337 
339  PlacementConstraintList PlacementConstraints;
340 
342  std::set<std::string> Queues;
343 
345  ResourceLimitList ResourceLimits;
346 
348  std::string StandardIn;
349 
351  std::string StandardErrFile;
352 
354  std::string StandardOutFile;
355 
358 
360  std::string StatusMessage;
361 
364 
366  std::set<std::string> Tags;
367 
370 
372  std::string WorkingDirectory;
373 
374 private:
375  friend class JobLock;
376 
377  // The private implementation of a Job object.
378  PRIVATE_IMPL(m_impl);
379 };
380 
387 struct JobConfig
388 {
394  enum class Type
395  {
397  ENUM,
398 
400  FLOAT,
401 
403  INT,
404 
406  STRING
407  };
408 
412  JobConfig() = default;
413 
420  JobConfig(std::string in_name, Type in_type);
421 
430  static Error fromJson(const json::Object& in_json, JobConfig& out_jobConfig);
431 
437  json::Object toJson() const;
438 
440  std::string Name;
441 
444 
446  std::string Value;
447 };
448 
451 {
452 public:
460  explicit JobLock(JobPtr in_job);
461 
469  explicit JobLock(ConstJobPtr in_job);
470 
471 private:
472  // The private implementation of JobLock.
473  PRIVATE_IMPL(m_impl);
474 };
475 
478 {
480  enum class Type
481  {
483  AZURE_FILE,
484 
486  CEPH_FS,
487 
489  GLUSTER_FS,
490 
492  HOST,
493 
495  NFS,
496 
499  };
500 
504  virtual ~MountSource() = default;
505 
514  static Error fromJson(const json::Object& in_json, MountSource& out_mountSource);
515 
524 
533 
542 
550  const CephFsMountSource& asCephFsMountSource() const;
551 
560 
569 
578 
586  const HostMountSource& asHostMountSource() const;
587 
596 
604  const NfsMountSource& asNfsMountSource() const;
605 
611  bool isAzureFileMountSource() const;
612 
618  bool isCephFsMountSource() const;
619 
625  bool isGlusterFsMountSource() const;
626 
632  bool isHostMountSource() const;
633 
639  bool isNfsMountSource() const;
640 
646  bool isPassthroughMountSource() const;
647 
653  json::Object toJson() const;
657  std::string CustomType;
658 
661 
664 };
665 
668 {
677  static Error fromJson(const json::Object& in_json, AzureFileMountSource& out_mountSource);
678 
686  std::string getSecretName() const;
687 
695  std::string getShareName() const;
696 
697 private:
702 
703  friend class MountSource;
704 };
705 
706 
709 {
718  static Error fromJson(const json::Object& in_json, CephFsMountSource& out_mountSource);
719 
727  std::vector<std::string> getMonitors() const;
728 
734  std::string getPath() const;
735 
741  std::string getUser() const;
742 
748  std::string getSecretFile() const;
749 
755  std::string getSecretRef() const;
756 
757 private:
762 
763  friend class MountSource;
764 };
765 
766 
768 {
773 
782  static Error fromJson(const json::Object& in_json, GlusterFsMountSource& out_mountSource);
783 
791  std::string getEndpoints() const;
792 
800  std::string getPath() const;
801 };
802 
805 {
814  static Error fromJson(const json::Object& in_json, HostMountSource& out_mountSource);
815 
823  std::string getPath() const;
824 
825 private:
829  HostMountSource();
830 
831  friend class MountSource;
832 };
833 
836 {
845  static Error fromJson(const json::Object& in_json, NfsMountSource& out_mountSource);
846 
854  std::string getHost() const;
855 
863  std::string getPath() const;
864 
865 private:
869  NfsMountSource();
870 
871  friend class MountSource;
872 };
873 
875 struct Mount
876 {
885  static Error fromJson(const json::Object& in_json, Mount& out_mount);
891  json::Object toJson() const;
892 
894  std::string Destination;
895 
898 
901 };
902 
920 {
924  PlacementConstraint() = default;
925 
933  explicit PlacementConstraint(std::string in_name);
934 
943  PlacementConstraint(std::string in_name, std::string in_value);
944 
953  static Error fromJson(const json::Object& in_json, PlacementConstraint& out_placementConstraint);
954 
960  json::Object toJson() const;
961 
963  std::string Name;
964 
966  std::string Value;
967 };
968 
971 {
977  struct Type
978  {
980  static const char* const CPU_COUNT;
981 
983  static const char* const CPU_TIME;
984 
986  static const char* const MEMORY;
987 
989  static const char* const MEMORY_SWAP;
990  };
991 
995  ResourceLimit() = default;
996 
1004  explicit ResourceLimit(std::string in_limitType, std::string in_maxValue = "", std::string in_defaultValue = "");
1005 
1014  static Error fromJson(const json::Object& in_json, ResourceLimit& out_resourceLimit);
1015 
1021  json::Object toJson() const;
1022 
1024  std::string ResourceType;
1025 
1027  std::string Value;
1028 
1030  std::string MaxValue;
1031 
1033  std::string DefaultValue;
1034 };
1035 
1036 #define LOCK_JOB(in_job) \
1037 try \
1038 { \
1039  rstudio::launcher_plugins::api::JobLock jobLock(in_job); \
1040 
1041 
1042 #define LOCK_MUTEX_AND_JOB(in_lockType, in_mutexType, in_mutex, in_job) \
1043 try \
1044 { \
1045  in_lockType<in_mutexType> mutexLock(in_mutex); \
1046  rstudio::launcher_plugins::api::JobLock jobLock(in_job); \
1047 
1048 
1049 #define END_LOCK_JOB END_LOCK_MUTEX
1050 
1051 #define END_LOCK_MUTEX_AND_JOB END_LOCK_JOB
1052 
1053 } // namespace api
1054 } // namespace launcher_plugins
1055 } // namespace rstudio
1056 
1057 #endif
rstudio::launcher_plugins::api::Job::Pid
Optional< pid_t > Pid
Definition: Job.hpp:336
rstudio::launcher_plugins::api::ExposedPort::PublishedPort
Optional< int > PublishedPort
Definition: Job.hpp:136
rstudio::launcher_plugins::api::Container::Image
std::string Image
Definition: Job.hpp:103
rstudio::launcher_plugins::api::MountSource::asHostMountSource
HostMountSource & asHostMountSource()
Gets this MountSource as an HostMountSource.
rstudio::launcher_plugins::api::ResourceLimit::toJson
json::Object toJson() const
Converts this ResourceLimit to a JSON object which represents it.
rstudio::launcher_plugins::api::JobConfig::Value
std::string Value
Definition: Job.hpp:446
rstudio::launcher_plugins::api::GlusterFsMountSource::fromJson
static Error fromJson(const json::Object &in_json, GlusterFsMountSource &out_mountSource)
Constructs a GlusterFsMountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::Job::Config
JobConfigList Config
Definition: Job.hpp:295
rstudio::launcher_plugins::api::PlacementConstraint
Struct which represents a custom placement constraint for the job.
Definition: Job.hpp:919
rstudio::launcher_plugins::api::Mount::toJson
json::Object toJson() const
Converts this Mount to a JSON object which represents it.
rstudio::launcher_plugins::api::Job::State::FAILED
rstudio::launcher_plugins::json::Object
Class which represents a specific type of JSON Value: a JSON object.
Definition: Json.hpp:687
rstudio::launcher_plugins::api::Job::User
system::User User
Definition: Job.hpp:369
rstudio::launcher_plugins::api::MountSource::toJson
json::Object toJson() const
Converts this NfsMountSource to a JSON object which represents it.
rstudio::launcher_plugins::api::Job::PlacementConstraints
PlacementConstraintList PlacementConstraints
Definition: Job.hpp:339
rstudio::launcher_plugins::api::Job::State::RUNNING
rstudio::launcher_plugins::api::PlacementConstraint::toJson
json::Object toJson() const
Converts this PlacementConstraint to a JSON object which represents it.
rstudio::launcher_plugins::api::Job
Structure which represents a job.
Definition: Job.hpp:146
rstudio::launcher_plugins::api::Job::Environment
EnvironmentList Environment
Definition: Job.hpp:301
rstudio::launcher_plugins::api::Job::ExitCode
Optional< int > ExitCode
Definition: Job.hpp:315
rstudio::launcher_plugins::api::JobConfig::Type::INT
rstudio::launcher_plugins::api::JobConfig::Type::FLOAT
rstudio::launcher_plugins::api::AzureFileMountSource::getSecretName
std::string getSecretName() const
Gets the name of the Azure Secret used to connect to the Azure File Mount Source.
rstudio::launcher_plugins::system::User
Class which represents a system user.
Definition: User.hpp:55
rstudio::launcher_plugins::api::AzureFileMountSource
Represents an Azure File Mount Source.
Definition: Job.hpp:667
rstudio::launcher_plugins::api::ResourceLimit::fromJson
static Error fromJson(const json::Object &in_json, ResourceLimit &out_resourceLimit)
Constructs a ResourceLimit from a JSON object which represents the resource limit.
rstudio::launcher_plugins::api::MountSource::Type::CEPH_FS
rstudio::launcher_plugins::api::ResourceLimit::Type::MEMORY_SWAP
static const char *const MEMORY_SWAP
Definition: Job.hpp:989
rstudio::launcher_plugins::api::CephFsMountSource::getMonitors
std::vector< std::string > getMonitors() const
Gets the list of Ceph monitor addresses.
rstudio::launcher_plugins::api::CephFsMountSource::getSecretRef
std::string getSecretRef() const
Gets the reference to the Ceph authentication secrets which override the Secret File.
rstudio::launcher_plugins::api::MountSource::SourceObject
json::Object SourceObject
Definition: Job.hpp:660
rstudio::launcher_plugins::api::Job::Command
std::string Command
The shell command to run.
Definition: Job.hpp:292
rstudio::launcher_plugins::api::JobLock::JobLock
JobLock(JobPtr in_job)
Constructor.
rstudio::launcher_plugins::api::AzureFileMountSource::getShareName
std::string getShareName() const
Gets the name of the share in Azure to be mounted.
rstudio::launcher_plugins::api::ResourceLimit::Type
Definition: Job.hpp:977
rstudio::launcher_plugins::api::GlusterFsMountSource::getPath
std::string getPath() const
Gets the name of the GlusterFs volume mount.
rstudio::launcher_plugins::api::Mount::IsReadOnly
bool IsReadOnly
Definition: Job.hpp:897
rstudio::launcher_plugins::api::MountSource::Type
Type
Constants representing the support types of MountSource.
Definition: Job.hpp:480
rstudio::launcher_plugins::api::CephFsMountSource::getSecretFile
std::string getSecretFile() const
Gets the location of the file which contains the Ceph keyring for authentication.
rstudio::launcher_plugins::api::CephFsMountSource::getUser
std::string getUser() const
Gets the user to mount the path as.
rstudio::launcher_plugins::api::Job::Mounts
MountList Mounts
Definition: Job.hpp:330
rstudio::launcher_plugins::api::Mount
Struct which represents an file system mount available to a job.
Definition: Job.hpp:875
rstudio::launcher_plugins::api::HostMountSource::getPath
std::string getPath() const
Gets the path on the current host to be mounted.
rstudio::launcher_plugins::api::MountSource::asCephFsMountSource
CephFsMountSource & asCephFsMountSource()
Gets this MountSource as an CephFsMountSource.
rstudio::launcher_plugins::api::Job::StandardIn
std::string StandardIn
Definition: Job.hpp:348
rstudio::launcher_plugins::api::MountSource::SourceType
Type SourceType
Definition: Job.hpp:663
rstudio::launcher_plugins::api::Job::LastUpdateTime
Optional< system::DateTime > LastUpdateTime
Definition: Job.hpp:327
rstudio::launcher_plugins::api::Job::State::UNKNOWN
rstudio::launcher_plugins::api::ResourceLimit
Struct which represents a resource limit for a job.
Definition: Job.hpp:970
rstudio::launcher_plugins::api::ResourceLimit::Type::CPU_COUNT
static const char *const CPU_COUNT
Definition: Job.hpp:980
rstudio::launcher_plugins::api::Job::fromJson
static Error fromJson(const json::Object &in_json, Job &out_job)
Constructs a Job from a JSON object which represents the job.
rstudio::launcher_plugins::api::MountSource::asNfsMountSource
NfsMountSource & asNfsMountSource()
Gets this MountSource as an NfsMountSource.
rstudio::launcher_plugins::api::ResourceLimit::Value
std::string Value
Definition: Job.hpp:1027
rstudio::launcher_plugins::api::Container::toJson
json::Object toJson() const
Converts this Container to a JSON object which represents it.
rstudio::launcher_plugins::api::Container::RunAsGroupId
Optional< int > RunAsGroupId
Definition: Job.hpp:109
rstudio::launcher_plugins::api::Job::State::SUSPENDED
rstudio::launcher_plugins::api::Job::Exe
std::string Exe
The executable to run.
Definition: Job.hpp:312
rstudio::launcher_plugins::api::MountSource::Type::NFS
rstudio::launcher_plugins::api::JobLock
RAII class for locking access to a Job object. Should be used every time a Job is modified.
Definition: Job.hpp:450
rstudio::launcher_plugins::api::CephFsMountSource::fromJson
static Error fromJson(const json::Object &in_json, CephFsMountSource &out_mountSource)
Constructs a CephFsMountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::Job::ContainerDetails
Optional< Container > ContainerDetails
Definition: Job.hpp:298
rstudio::launcher_plugins::api::MountSource::CustomType
std::string CustomType
Definition: Job.hpp:657
rstudio::launcher_plugins::api::JobConfig::ValueType
Optional< Type > ValueType
Definition: Job.hpp:443
rstudio::launcher_plugins::api::NfsMountSource::getPath
std::string getPath() const
Gets the path on the NFS host to be mounted.
Json.hpp
rstudio::launcher_plugins::api::ResourceLimit::Type::MEMORY
static const char *const MEMORY
Definition: Job.hpp:986
rstudio::launcher_plugins::api::AzureFileMountSource::fromJson
static Error fromJson(const json::Object &in_json, AzureFileMountSource &out_mountSource)
Constructs an AzureMountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::CephFsMountSource
Represents a Ceph File System Mount Source.
Definition: Job.hpp:708
rstudio::launcher_plugins::api::Job::State::FINISHED
rstudio::launcher_plugins::api::Job::ResourceLimits
ResourceLimitList ResourceLimits
Definition: Job.hpp:345
rstudio::launcher_plugins::api::Job::operator=
Job & operator=(const Job &in_other)
Assignment operator.
rstudio::launcher_plugins::api::ResourceLimit::MaxValue
std::string MaxValue
Definition: Job.hpp:1030
rstudio::launcher_plugins::api::MountSource::asGlusterFsMountSource
GlusterFsMountSource & asGlusterFsMountSource()
Gets this MountSource as an GlusterFsMountSource.
rstudio::launcher_plugins::api::Job::toJson
json::Object toJson() const
Converts this Job to a JSON object which represents it.
rstudio::launcher_plugins::api::ExposedPort::Protocol
std::string Protocol
Definition: Job.hpp:139
rstudio::launcher_plugins::api::JobConfig::fromJson
static Error fromJson(const json::Object &in_json, JobConfig &out_jobConfig)
Constructs a JobConfig from a JSON object which represents the job config.
rstudio::launcher_plugins::api::Job::stateToString
static std::string stateToString(State in_status)
Converts a Job::State enum value into its string representation.
rstudio::launcher_plugins::api::Mount::Destination
std::string Destination
Definition: Job.hpp:894
rstudio::launcher_plugins::api::Job::Job
Job()
Constructor.
rstudio::launcher_plugins::api::MountSource::isPassthroughMountSource
bool isPassthroughMountSource() const
Checks whether this MountSource is an PassthroughMountSource.
rstudio::launcher_plugins::api::Job::WorkingDirectory
std::string WorkingDirectory
Definition: Job.hpp:372
rstudio::launcher_plugins::api::Job::State
State
Definition: Job.hpp:153
rstudio::launcher_plugins::api::Job::StatusMessage
std::string StatusMessage
Definition: Job.hpp:360
rstudio::launcher_plugins::api::ExposedPort::toJson
json::Object toJson() const
Converts this ExposedPort to a JSON object which represents it.
rstudio::launcher_plugins::api::MountSource
Struct which represents the source path of an NFS Mount.
Definition: Job.hpp:477
rstudio::launcher_plugins::api::GlusterFsMountSource
Definition: Job.hpp:767
rstudio::launcher_plugins::api::ExposedPort
Struct which represents an exposed port on a containerized job.
Definition: Job.hpp:116
rstudio::launcher_plugins::api::JobConfig::Type::STRING
rstudio::launcher_plugins::api::ResourceLimit::ResourceType
std::string ResourceType
Definition: Job.hpp:1024
rstudio::launcher_plugins::api::NfsMountSource
Represents an NFS Mount Source.
Definition: Job.hpp:835
rstudio::launcher_plugins::system::DateTime
Class which represents a date and time in UTC.
Definition: DateTime.hpp:244
rstudio::launcher_plugins::api::MountSource::Type::HOST
rstudio::launcher_plugins::Error
Class which represents an error.
Definition: Error.hpp:174
rstudio::launcher_plugins::api::Job::Arguments
std::vector< std::string > Arguments
Definition: Job.hpp:279
rstudio::launcher_plugins::api::Job::Cluster
std::string Cluster
Definition: Job.hpp:282
rstudio::launcher_plugins::api::NfsMountSource::fromJson
static Error fromJson(const json::Object &in_json, NfsMountSource &out_mountSource)
Constructs an NfsMountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::MountSource::Type::AZURE_FILE
rstudio::launcher_plugins::api::Container::fromJson
static Error fromJson(const json::Object &in_json, Container &out_container)
Constructs a Container from a JSON object which represents the container.
rstudio::launcher_plugins::api::MountSource::isNfsMountSource
bool isNfsMountSource() const
Checks whether this MountSource is an NfsMountSource.
rstudio::launcher_plugins::api::ResourceLimit::Type::CPU_TIME
static const char *const CPU_TIME
Definition: Job.hpp:983
rstudio::launcher_plugins::api::Job::getJobConfigValue
Optional< std::string > getJobConfigValue(const std::string &in_name) const
Gets a job configuration value, if it exists.
rstudio::launcher_plugins::api::MountSource::asAzureFileMountSource
AzureFileMountSource & asAzureFileMountSource()
Gets this MountSource as an AzureFileMountSource.
rstudio::launcher_plugins::api::JobConfig
Struct which represents a custom configuration setting for jobs launched with a given Plugin.
Definition: Job.hpp:387
rstudio::launcher_plugins::api::Job::Tags
std::set< std::string > Tags
Definition: Job.hpp:366
rstudio::launcher_plugins::api::PlacementConstraint::Name
std::string Name
Definition: Job.hpp:963
rstudio::launcher_plugins::api::JobConfig::Type::ENUM
rstudio::launcher_plugins::api::MountSource::Type::GLUSTER_FS
rstudio::launcher_plugins::api::Job::Id
std::string Id
Definition: Job.hpp:324
rstudio::launcher_plugins::api::Container::SupplementalGroupIds
std::vector< int > SupplementalGroupIds
Definition: Job.hpp:112
rstudio::launcher_plugins::api::MountSource::fromJson
static Error fromJson(const json::Object &in_json, MountSource &out_mountSource)
Constructs a MountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::PlacementConstraint::Value
std::string Value
Definition: Job.hpp:966
rstudio::launcher_plugins::Noncopyable
Class which can be inherited from to disallow copying of its child classes.
Definition: Noncopyable.hpp:34
rstudio::launcher_plugins::api::JobConfig::Type
Type
Definition: Job.hpp:394
rstudio::launcher_plugins::api::Job::Host
std::string Host
Definition: Job.hpp:321
rstudio::launcher_plugins::api::Job::SubmissionTime
system::DateTime SubmissionTime
Definition: Job.hpp:363
rstudio::launcher_plugins::api::MountSource::isCephFsMountSource
bool isCephFsMountSource() const
Checks whether this MountSource is an CephFsMountSource.
rstudio::launcher_plugins::Optional< int >
rstudio::launcher_plugins::api::MountSource::~MountSource
virtual ~MountSource()=default
Virtual destructor for inheritance.
rstudio::launcher_plugins::api::MountSource::isGlusterFsMountSource
bool isGlusterFsMountSource() const
Checks whether this MountSource is an GlusterFsMountSource.
rstudio::launcher_plugins::api::JobConfig::toJson
json::Object toJson() const
Converts this JobConfig to a JSON object which represents it.
rstudio::launcher_plugins::api::MountSource::isAzureFileMountSource
bool isAzureFileMountSource() const
Checks whether this MountSource is an AzureFileMountSource.
rstudio::launcher_plugins::api::Job::matchesTags
bool matchesTags(const std::set< std::string > &in_tags) const
Checks whether the job has all of the supplied tags.
rstudio::launcher_plugins::api::PlacementConstraint::fromJson
static Error fromJson(const json::Object &in_json, PlacementConstraint &out_placementConstraint)
Constructs a PlacementConstraint from a JSON object which represents the placement constraint.
rstudio::launcher_plugins::api::ResourceLimit::ResourceLimit
ResourceLimit()=default
Default constructor.
rstudio::launcher_plugins::api::MountSource::isHostMountSource
bool isHostMountSource() const
Checks whether this MountSource is an HostMountSource.
rstudio::launcher_plugins::api::CephFsMountSource::getPath
std::string getPath() const
Gets the path to mount.
rstudio::launcher_plugins::api::Job::Name
std::string Name
Definition: Job.hpp:333
rstudio::launcher_plugins::api::Container
Struct which represents the container to use when launching a containerized job.
Definition: Job.hpp:83
rstudio::launcher_plugins::api::Job::StandardErrFile
std::string StandardErrFile
Definition: Job.hpp:351
rstudio::launcher_plugins::api::Job::Status
State Status
Definition: Job.hpp:357
rstudio::launcher_plugins::api::Job::stateFromString
static Error stateFromString(const std::string &in_statusString, State &out_status)
Converts a status string into its equivalent Job::State enum value.
rstudio::launcher_plugins::api::Job::ExposedPorts
ExposedPortList ExposedPorts
Definition: Job.hpp:318
rstudio::launcher_plugins::api::Mount::fromJson
static Error fromJson(const json::Object &in_json, Mount &out_mount)
Constructs a Mount from a JSON object which represents the mount.
rstudio::launcher_plugins::api::Job::isCompleted
bool isCompleted() const
Checks whether the job has completed (i.e. the job's state is a completed state).
rstudio::launcher_plugins::api::GlusterFsMountSource::GlusterFsMountSource
GlusterFsMountSource()
Constructor.
rstudio::launcher_plugins::api::Job::Queues
std::set< std::string > Queues
Definition: Job.hpp:342
rstudio::launcher_plugins::api::GlusterFsMountSource::getEndpoints
std::string getEndpoints() const
Gets the name of the endpoints object that represents a Gluster cluster configuration.
rstudio::launcher_plugins::api::PlacementConstraint::PlacementConstraint
PlacementConstraint()=default
Default constructor.
rstudio::launcher_plugins::api::HostMountSource::fromJson
static Error fromJson(const json::Object &in_json, HostMountSource &out_mountSource)
Constructs a HostMountSource from a JSON object which represents the mount source.
rstudio::launcher_plugins::api::NfsMountSource::getHost
std::string getHost() const
Gets the NFS host.
rstudio::launcher_plugins::api::Job::State::PENDING
rstudio::launcher_plugins::api::MountSource::Type::PASSTHROUGH
rstudio::launcher_plugins::api::JobConfig::JobConfig
JobConfig()=default
Default constructor.
rstudio::launcher_plugins::api::ResourceLimit::DefaultValue
std::string DefaultValue
Definition: Job.hpp:1033
rstudio::launcher_plugins::api::Job::State::CANCELED
rstudio::launcher_plugins::api::JobConfig::Name
std::string Name
Definition: Job.hpp:440
rstudio::launcher_plugins::api::Job::State::KILLED
rstudio::launcher_plugins::api::Mount::Source
MountSource Source
Definition: Job.hpp:900
rstudio::launcher_plugins::api::HostMountSource
Represents a path to mount on the same host as the Job.
Definition: Job.hpp:804
rstudio::launcher_plugins::api::ExposedPort::fromJson
static Error fromJson(const json::Object &in_json, ExposedPort &out_exposedPort)
Constructs an ExposedPort from a JSON object which represents the exposed port.
rstudio::launcher_plugins::api::ExposedPort::TargetPort
int TargetPort
Definition: Job.hpp:142
rstudio::launcher_plugins::api::Job::StandardOutFile
std::string StandardOutFile
Definition: Job.hpp:354
rstudio::launcher_plugins::api::Container::RunAsUserId
Optional< int > RunAsUserId
Definition: Job.hpp:106