Skip to content

Commit 097229c

Browse files
committed
msgflo.main(): Make role optional, try to infer
1 parent 8391037 commit 097229c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

msgflo/msgflo.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,13 @@ def run(participant, broker=None, done_cb=None):
310310

311311
return engine
312312

313-
def main(Participant, role):
313+
def main(Participant, role=None):
314+
if not role:
315+
try:
316+
role = sys.argv[0]
317+
except IndexError, e:
318+
role = participant.definition.component.tolower()
319+
314320
participant = Participant(role)
315321
d = participant.definition
316322
waiter = gevent.event.AsyncResult()

0 commit comments

Comments
 (0)