コード例 #1
0
ファイル: tx.py プロジェクト: igorcanadi/firecloud
def transition(state, arrow):
  (new_state, action) = STATETBL[state][arrow]
  if new_state == 'D':
    barf('INVALID State Transition: {0} - {1} -> {2}'.format(state, arrow, new_state))
    raise CapelTrap()

  return (new_state, action)
コード例 #2
0
ファイル: main.py プロジェクト: igorcanadi/firecloud
  log('master is:' + str(master))
  #print 'Starting as {0} as master? {1}'.format(me, master)
  n = net.Network(d, addrs, me, master)
  evtloop = net.EventLoop(n)
  evtloop.poll()

if len(sys.argv) <= 1:
  print "usage: main.py IDX host:port [host:port ...]"
  raise SystemExit

idx = int(sys.argv[1])

addrs = []
for a in sys.argv[2:]:
  l = a.split(':')
  addrs.append((l[0], int(l[1])))

master = '0'

sortd = sorted(addrs)
#print addrs, sortd
if addrs[idx] == sortd[0]:
  master = '1'

try:
  log('starting v2.0!')
  main(idx, master, addrs)
except Exception, e:
  barf('ERROR')
  barf(traceback.format_exc())