softwarecontainer  0.18.0-739e8d7 2017-05-04
softwarecontainer::JobAbstract Class Reference

Abstract class for jobs which get executed inside a container. More...

#include <jobabstract.h>

Inheritance diagram for softwarecontainer::JobAbstract:
[legend]

Public Member Functions

 JobAbstract (ExecutablePtr &executable)
 
void captureStdin ()
 
void setOutputFile (const std::string &path)
 
void captureStdout ()
 
void captureStderr ()
 
int wait ()
 
int stdout ()
 
int stderr ()
 
int stdin ()
 
pid_t pid ()
 
bool isSuccess ()
 Helper about return value of jobs. More...
 
bool isError ()
 Helper about return value of jobs. More...
 
bool isRunning ()
 That method always returns true as soon as the start() method has been called, even if the command fails to start, since we don't know if the exec() occurring after the fork into the container actually succeeds... More...
 
void setEnvironmentVariable (const std::string &key, const std::string &value)
 
void setEnvironmentVariables (const EnvironmentVariables &env)
 

Static Public Attributes

static constexpr int UNASSIGNED_STREAM
 

Protected Types

typedef std::shared_ptr< ExecutableExecutablePtr
 

Protected Member Functions

 LOG_DECLARE_CLASS_CONTEXT ("JOAB","JobAbstract")
 

Protected Attributes

EnvironmentVariables m_env
 
ExecutablePtr m_executable
 
int m_exitStatus
 
pid_t m_pid
 
int m_stdin [2]
 
int m_stdout [2]
 
int m_stderr [2]
 

Detailed Description

Abstract class for jobs which get executed inside a container.

Definition at line 29 of file jobabstract.h.

Member Function Documentation

bool softwarecontainer::JobAbstract::isSuccess ( )

Helper about return value of jobs.

Describes whether the exit status of a command or a function indicates success or not

Note that this method will interpret exit status only for the last job

Definition at line 85 of file jobabstract.cpp.

86 {
87  if (0 == m_exitStatus) {
88  return true;
89  }
90 
91  return false;
92 }
bool softwarecontainer::JobAbstract::isError ( )

Helper about return value of jobs.

Describes whether the exit status of a command or a function indicates error or not

Note that this method will interpret exit status only for the last job

Definition at line 94 of file jobabstract.cpp.

95 {
96  return !isSuccess();
97 }
bool isSuccess()
Helper about return value of jobs.
Definition: jobabstract.cpp:85
bool softwarecontainer::JobAbstract::isRunning ( )

That method always returns true as soon as the start() method has been called, even if the command fails to start, since we don't know if the exec() occurring after the fork into the container actually succeeds...

Definition at line 103 of file jobabstract.cpp.

104 {
105  // TODO : find a way to test whether the exec() which occurs in the container succeeded
106  return (m_pid != 0);
107 }

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