|
|
@ -19,6 +19,7 @@ import basic.componentHandling |
|
|
|
import utils.date_tool |
|
|
|
import utils.path_tool |
|
|
|
import utils.file_tool |
|
|
|
import utils.config_tool |
|
|
|
|
|
|
|
|
|
|
|
jobdef = { |
|
|
@ -109,18 +110,24 @@ EXCP_CANT_POP = "cant pop this job from the instances" |
|
|
|
|
|
|
|
class Job: |
|
|
|
__instance = None |
|
|
|
instances = [] |
|
|
|
__instances = [] |
|
|
|
|
|
|
|
def __init__ (self, program): |
|
|
|
print ("################# init Job ## " + program + " #################") |
|
|
|
self.program = program |
|
|
|
Job.__instance = self |
|
|
|
if Job.__instances is None: |
|
|
|
Job.__instances = [] |
|
|
|
Job.pushInstance(self) |
|
|
|
par = Parameter(program) |
|
|
|
self.par = par |
|
|
|
print("prog-42 " + str(self.par.basedir)) |
|
|
|
conf = Configuration(program) |
|
|
|
self.conf = conf |
|
|
|
appl = utils.config_tool.getConfig("basic", B.SUBJECT_APPS) |
|
|
|
print(appl) |
|
|
|
if appl is not None: |
|
|
|
self.conf.confs[B.SUBJECT_APPS] = appl[B.SUBJECT_APPS] |
|
|
|
print("prog-45 " + str(self.par.basedir)) |
|
|
|
dirpath = self.par.getDirParameter() |
|
|
|
setGlobal() |
|
|
@ -138,27 +145,27 @@ class Job: |
|
|
|
if pjob is not None and Job.__instance is not None and Job.__instance != pjob: |
|
|
|
raise Exception(B.EXP_CANT_POP) |
|
|
|
# for guarantee that both the stack and the original variable is empty if one is empty |
|
|
|
if len(Job.instances) < 1: |
|
|
|
if len(Job.__instances) < 1: |
|
|
|
Job.__instance = None |
|
|
|
return None |
|
|
|
if Job.__instance is None: |
|
|
|
while len(Job.instances) > 0: |
|
|
|
Job.instances.pop() |
|
|
|
while len(Job.__instances) > 0: |
|
|
|
Job.__instances.pop() |
|
|
|
return None |
|
|
|
if len(Job.instances) == 1: |
|
|
|
if len(Job.__instances) == 1: |
|
|
|
job = Job.__instance |
|
|
|
job.stopJob(1) |
|
|
|
Job.instances.pop() |
|
|
|
Job.__instances.pop() |
|
|
|
Job.__instance = None |
|
|
|
return None |
|
|
|
job = Job.instances.pop() |
|
|
|
job = Job.__instances.pop() |
|
|
|
if pjob is not None and job is not None and job != pjob: |
|
|
|
Job.instances.append(job) |
|
|
|
Job.__instances.append(job) |
|
|
|
Job.__instance = job |
|
|
|
raise Exception(B.EXP_CANT_POP) |
|
|
|
if len(Job.instances) > 0: |
|
|
|
topjob = Job.instances.pop() |
|
|
|
Job.instances.append(topjob) |
|
|
|
if len(Job.__instances) > 0: |
|
|
|
topjob = Job.__instances.pop() |
|
|
|
Job.__instances.append(topjob) |
|
|
|
Job.__instance = topjob |
|
|
|
else: |
|
|
|
Job.__instance = None |
|
|
@ -168,11 +175,11 @@ class Job: |
|
|
|
@staticmethod |
|
|
|
def pushInstance(pjob): |
|
|
|
""" push a new created subjob """ |
|
|
|
if len(Job.instances) > 0: |
|
|
|
job = Job.instances.pop() |
|
|
|
if len(Job.__instances) > 0: |
|
|
|
job = Job.__instances.pop() |
|
|
|
if pjob is not None and job is not None and job != pjob: |
|
|
|
Job.instances.append(job) |
|
|
|
Job.instances.append(pjob) |
|
|
|
Job.__instances.append(job) |
|
|
|
Job.__instances.append(pjob) |
|
|
|
Job.__instance = pjob |
|
|
|
return pjob |
|
|
|
|
|
|
@ -249,6 +256,8 @@ class Job: |
|
|
|
for c in cconf: |
|
|
|
output[B.SUBJECT_COMPS][c] = {} |
|
|
|
for x in ["function", "conn"]: |
|
|
|
if x not in cconf[c]: |
|
|
|
continue |
|
|
|
output[B.SUBJECT_COMPS][c][x] = cconf[c][x] |
|
|
|
if x == B.SUBJECT_CONN and "passwd" in cconf[c][x]: |
|
|
|
cconf[B.SUBJECT_COMPS][c][x]["passwd"] = "xxxxx" |
|
|
@ -435,6 +444,12 @@ class Parameter: |
|
|
|
dirpath = self.getDirParameter() |
|
|
|
if dirpath is not None: |
|
|
|
utils.path_tool.extractPath(dirpath[0], dirpath[1]) |
|
|
|
app = self.application |
|
|
|
if self.application in job.conf.confs[B.SUBJECT_APPS]: |
|
|
|
if B.ATTR_APPS_PROJECT in job.conf.confs[B.SUBJECT_APPS][self.application]: |
|
|
|
setattr(self, B.ATTR_APPS_PROJECT, job.conf.confs[B.SUBJECT_APPS][self.application][B.ATTR_APPS_PROJECT]) |
|
|
|
proj = getattr(self, B.ATTR_APPS_PROJECT) |
|
|
|
app2 = self.application |
|
|
|
|
|
|
|
|
|
|
|
def setParameterLoaded(self): |
|
|
|