HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
dtm.EventObjects.NewTask Class Reference

NewTask event object, defines the Task object fields. More...

Inheritance diagram for dtm.EventObjects.NewTask:
Collaboration diagram for dtm.EventObjects.NewTask:

Public Member Functions

def __init__ (self, taskCommandLine, taskId=None, name=None)
 constructor initialize task's fields More...
 
def toJSON (self)
 
- Public Member Functions inherited from dtm.EventObjects.Task
def __init__ (self)
 constructor initialize task's fields More...
 
def setSessionVar (self, sessionVarName, sessionVarValue)
 Set the OS session variable for EE process. More...
 
def setStrategyVar (self, strategyVarName, strategyVarValue)
 Set the strategy variable. More...
 
def setFile (self, fileItem)
 Set the file item. More...
 
def setLimitsVar (self, limitsVarName, limitsVarValue)
 Set the limits variable. More...
 

Public Attributes

 id
 The task Id. More...
 
 name
 
 command
 The task command line to execute inside EE. More...
 
 input
 The task cstdin stream buffer for EE process. More...
 
- Public Attributes inherited from dtm.EventObjects.Task
 id
 The task Id. More...
 
 command
 The task command line to execute inside EE. More...
 
 input
 The task cstdin stream buffer for EE process. More...
 
 files
 The task files items attached init. More...
 
 session
 The task session items init. More...
 
 strategy
 The task strategy items init. More...
 
 limits
 The task limits init. More...
 
 autoCleanupFields
 The task autoCleanupFields init. More...
 
 type
 The task type init. More...
 
 name
 The task name init. More...
 

Additional Inherited Members

- Static Public Attributes inherited from dtm.EventObjects.Task
int FILE_ACTION_CREATE_BEFORE = 1
 
int FILE_ACTION_DELETE_BEFORE = 2
 
int FILE_ACTION_READ_AFTER = 4
 
int FILE_ACTION_DELETE_AFTER = 8
 
int FILE_ACTION_BASE64_ENCODED = 2147483648
 
string STRATEGY_DATE = "DATE"
 
string STRATEGY_DATE_MAX = "DATE_MAX"
 
string STRATEGY_DATE_SHIFT = "DATE_SHIFT"
 
string STRATEGY_CPU = "CPU"
 
string STRATEGY_RAM_FREE = "RAM_FREE"
 
string STRATEGY_RAM = "RAM"
 
string STRATEGY_DISK_FREE = "DISK_FREE"
 
string STRATEGY_DISK = "DISK"
 
string STRATEGY_TIME = "TIME"
 
string STRATEGY_THREADS = "THREADS"
 
string STRATEGY_SDELAY = "SDELAY"
 
string STRATEGY_RDELAY = "RDELAY"
 
string STRATEGY_RETRY = "RETRY"
 
string STRATEGY_PRIORITY = "PRIORITY"
 
string STRATEGY_CPU_LOAD_MAX = "CPU_LOAD_MAX"
 
string STRATEGY_IO_WAIT_MAX = "IO_WAIT_MAX"
 
string STRATEGY_autoCleanupFields = "autoCleanupFields"
 
string STRATEGY_AUTOCLEANUP_TTL = "TTL"
 
string STRATEGY_AUTOCLEANUP_DELETE_TYPE = "DeleteType"
 
string STRATEGY_AUTOCLEANUP_DELETE_RETRIES = "DeleteRetries"
 
string STRATEGY_AUTOCLEANUP_SSTATE = "State"
 
int TASK_MODE_SYNCH = 1
 
int TASK_MODE_ASYNCH = 2
 
int TIME_MAX_DEFAULT = 60000
 
int TASK_TYPE_SHELL = 0
 
int TASK_TYPE_SSH = 1
 
int TYPE_DEFAULT = 0
 

Detailed Description

NewTask event object, defines the Task object fields.

The task object used to create new task representation inside DTM application. This is a main data unit that is used by DTM inside to operate.

Definition at line 151 of file EventObjects.py.

Constructor & Destructor Documentation

◆ __init__()

def dtm.EventObjects.NewTask.__init__ (   self,
  taskCommandLine,
  taskId = None,
  name = None 
)

constructor initialize task's fields

Parameters
taskCommandLineThe task's command line to execute in EE.
taskIdThe task's unique identifier, optional if omitted - generated as crc32 of the command.

Definition at line 158 of file EventObjects.py.

158  def __init__(self, taskCommandLine, taskId=None, name=None):
159  super(NewTask, self).__init__()
160 
162  if taskId is None:
163  idGenerator = IDGenerator()
164  #self.id = ctypes.c_ulong(zlib.crc32(idGenerator.get_connection_uid())).value
165  #self.id = ctypes.c_uint32(zlib.crc32(idGenerator.get_connection_uid(), int(time.time()))).value
166  self.id = getHash(idGenerator.get_connection_uid())
167  else:
168  self.id = taskId
169  if name is not None:
170  self.name = name
171 
173  self.command = taskCommandLine
174 
176  self.input = ""
177  #Strategy priority init
178  self.setStrategyVar(self.STRATEGY_PRIORITY, 1)
179  #Session init
180  self.setSessionVar("time_max", self.TIME_MAX_DEFAULT)
181  self.setSessionVar("tmode", self.TASK_MODE_SYNCH)
182  self.setSessionVar("type", self.TASK_TYPE_SHELL)
183  self.setSessionVar("home_directory", "")
184  self.setSessionVar("port", 0)
185  self.setSessionVar("user", "")
186  self.setSessionVar("password", "")
187  self.setSessionVar("shell", "")
188  self.setSessionVar("environment", {})
189  self.setSessionVar("timeout", 0)
190 
191 
def __init__(self)
constructor
Definition: UIDGenerator.py:19
def getHash(strBuf, binSize=32, digestType=0, fixedMode=0, valLimit=18446744073709552000L)
Definition: Utils.py:1649

Member Function Documentation

◆ toJSON()

def dtm.EventObjects.NewTask.toJSON (   self)

Definition at line 192 of file EventObjects.py.

192  def toJSON(self):
193  return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4)
194 
195 
196 

Member Data Documentation

◆ command

dtm.EventObjects.NewTask.command

The task command line to execute inside EE.

Definition at line 173 of file EventObjects.py.

◆ id

dtm.EventObjects.NewTask.id

The task Id.

Definition at line 166 of file EventObjects.py.

◆ input

dtm.EventObjects.NewTask.input

The task cstdin stream buffer for EE process.

Definition at line 176 of file EventObjects.py.

◆ name

dtm.EventObjects.NewTask.name

Definition at line 170 of file EventObjects.py.


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