Skip to content

Commit

Permalink
Merge pull request #719 from SteVwonder/python-binding-tweaks
Browse files Browse the repository at this point in the history
python: minor fixes and addition to the bindings
  • Loading branch information
garlick authored Jul 8, 2016
2 parents 36cb5cc + 11064ee commit cee58a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/bindings/python/flux/core/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def msg_watcher_create(self, callback,
topic_glob='*',
args=None,
match_tag=flux.FLUX_MATCHTAG_NONE):
return MessageWatcher(self, type_mask, callback, topic_glob, match_tag,
bsize, args)
return MessageWatcher(self, type_mask, callback, topic_glob,
match_tag, args)

def timer_watcher_create(self, after, callback, repeat=0.0, args=None):
return TimerWatcher(self, after, callback, repeat=repeat, args=args)
Expand All @@ -141,6 +141,11 @@ def barrier(self, name, nprocs):
_raw_barrier.barrier(self, name, nprocs)


def get_rank(self):
rank = ffi.new('uint32_t [1]')
self.flux_get_rank(rank)
return rank[0]

def open(url, flags=0):
""" Open a connection to the specified flux connector """
return Flux(url, flags=flags)
3 changes: 1 addition & 2 deletions src/bindings/python/flux/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ def completed(self):
return bool(self.pimpl.completed())

def get_str(self):
c_nodeid = ffi.new('uint32_t [1]')
j_str = ffi.new('char *[1]')
self.pimpl.get(c_nodeid, j_str)
self.pimpl.get(ffi.NULL, j_str)
return ffi.string(j_str[0])

def get(self):
Expand Down
4 changes: 4 additions & 0 deletions src/bindings/python/test/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ def test_rpc_ping(self):
self.assertEqual(r['seq'], 1)
self.assertEqual(r['pad'], 'stuff')

def test_get_rank(self):
"""Get flux rank"""
rank = self.f.get_rank()
self.assertEqual(rank, 0)

0 comments on commit cee58a2

Please sign in to comment.