Skip to content

Commit

Permalink
Fixed issues related to etcd_server parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Shubhendu <shtripat@redhat.com>
  • Loading branch information
Shubhendu committed Jan 16, 2017
1 parent 805e11a commit f19c9f7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tendrl/commons/flows/base_flow.py
Expand Up @@ -204,7 +204,7 @@ def extract_atom_details(self, atom_name):
namespace = atom_name.split('.objects.')[0]
object_name = atom_name.split('.objects.')[1].split('.atoms.')[0]
atoms = self.definitions[namespace]['objects'][object_name]['atoms']
atom = atoms[atom_name.split('.')[-1]]
atom = atoms[atom_name.split('.')[-2]]
return atom.get('name'), atom.get('enabled'), atom.get('help'), \
atom.get('inputs'), atom.get('outputs'), atom.get('uuid')

Expand Down
10 changes: 5 additions & 5 deletions tendrl/commons/manager/rpc_job_process.py
Expand Up @@ -30,7 +30,7 @@ def _process_job(self, raw_job, job_key, job_type):
raw_job['request_id'] = "/clusters/%s/_jobs/%s_%s" % (
self.syncJobThread._manager.integration_id, raw_job['run'],
req_id)
self.client.write(job_key, json.dumps(raw_job))
self.client.client.write(job_key, json.dumps(raw_job))
try:
definitions = self.validate_flow(raw_job)
if definitions:
Expand All @@ -47,7 +47,7 @@ def _process_job(self, raw_job, job_key, job_type):

def _acceptor(self, job_type):
while not self.syncJobThread._complete.is_set():
jobs = self.client.read("/queue")
jobs = self.client.client.read("/queue")
for job in jobs.children:
executed = False
if job.value is None:
Expand All @@ -73,7 +73,7 @@ def _acceptor(self, job_type):
except FlowExecutionFailedError as e:
LOG.error(e)
if executed:
self.client.write(job.key, json.dumps(raw_job))
self.client.client.write(job.key, json.dumps(raw_job))
break
gevent.sleep(2)

Expand All @@ -85,7 +85,7 @@ def stop(self):

def validate_flow(self, raw_job):
definitions = yaml.load(
self.client.read(
self.client.client.read(
self.syncJobThread._manager.defs_dir
).value.decode("utf-8")
)
Expand All @@ -104,7 +104,7 @@ def invoke_flow(self, flow_name, job, definitions):
the_flow = import_utils.load_abs_class(flow_name)
return the_flow(flow_name, atoms, help, enabled, inputs, pre_run,
post_run, type, uuid, job['parameters'],
job, self.config, definitions).run()
job, definitions).run()

def extract_flow_details(self, flow_name, definitions):
try:
Expand Down
12 changes: 6 additions & 6 deletions tendrl/commons/tests/test_base_flow.py
Expand Up @@ -58,9 +58,9 @@ def setup_method(self):
}

self.flow_pre_run = \
['tendrl.dummymodule.objects.myobject.atoms.pre_run1']
['tendrl.dummymodule.objects.myobject.atoms.pre_run1.PreRun1']
self.flow_post_run = \
['tendrl.dummymodule.objects.myobject.atoms.post_run1']
['tendrl.dummymodule.objects.myobject.atoms.post_run1.PostRun1']
self.flow_parameters = {
'Tendrl_context.cluster_id':
"61959242-628f-4847-a5e2-2c8d8daac0ab",
Expand Down Expand Up @@ -148,7 +148,7 @@ def setup_method(self):
'flows': {
'dummy_flow': {
'atoms': [
'tendrl.dummymodule.objects.myobject.atoms.atom1'
'tendrl.dummymodule.objects.myobject.atoms.atom1.Atom1'
],
'help': 'dummy_flow',
'enabled': True,
Expand All @@ -161,11 +161,11 @@ def setup_method(self):
},
'pre_run': [
'tendrl.dummymodule.objects.myobject.atoms.'
'pre_run1'
'pre_run1.PreRun1'
],
'post_run': [
'tendrl.dummymodule.objects.myobject.atoms.'
'post_run1'
'post_run1.PostRun1'
],
'run': 'tendrl.dummymodule.flows.dummy_flow.DummyFlow',
'type': 'Create',
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_run(self):
def test_extract_atom_details(self):
name, enabled, help, inputs, outputs, uuid = \
self.flow_obj.extract_atom_details(
"tendrl.dummymodule.objects.myobject.atoms.pre_run1",
"tendrl.dummymodule.objects.myobject.atoms.pre_run1.PreRun1",
)
assert name == "pre_run1"
assert enabled is True
Expand Down
4 changes: 2 additions & 2 deletions tendrl/commons/utils/import_utils.py
Expand Up @@ -7,6 +7,6 @@ def load_abs_module(module_abs_path):


def load_abs_class(class_abs_path):
kls_name = class_abs_path.split(".")[:-1]
kls_name = class_abs_path.split(".")[-1]
module_name = ".".join(class_abs_path.split(".")[:-1])
return getattr(kls_name, load_abs_module(module_name))
return getattr(load_abs_module(module_name), kls_name)

0 comments on commit f19c9f7

Please sign in to comment.