Example #1
0
 def test_build(self):
   p1 = FlowProperty(mode1='a', mode2='b')
   p2 = FlowProperty(mode1='A', mode3='C')
   job = FlowJob('foo', 'mode1')
   with temppath() as tpath:
     job.build(path=tpath)
     eq_(read_properties(tpath), {
       'type': 'flow',
       'flow.name': 'foo',
       'flow.property.0': 'a',
       'flow.property.1': 'A',
     })
Example #2
0
 def test_build(self):
     p1 = FlowProperty(mode1='a', mode2='b')
     p2 = FlowProperty(mode1='A', mode3='C')
     job = FlowJob('foo', 'mode1')
     with temppath() as tpath:
         job.build(path=tpath)
         eq_(
             read_properties(tpath), {
                 'type': 'flow',
                 'flow.name': 'foo',
                 'flow.property.0': 'a',
                 'flow.property.1': 'A',
             })
Example #3
0
def _parse_option(_option):
  """Parse `--option` argument.

  :param _option: `--option` argument.

  Returns a dictionary.

  """
  paths = (opt for opt in _option if not '=' in opt)
  opts = read_properties(*paths)
  try:
    opts.update(dict(s.split('=', 1) for s in _option if '=' in s))
  except ValueError:
    raise AzkabanError('Invalid `--option` flag.')
  return opts
Example #4
0
def _parse_option(_option):
  """Parse `--option` argument.

  :param _option: `--option` argument.

  Returns a dictionary.

  """
  paths = (opt for opt in _option if not '=' in opt)
  opts = read_properties(*paths)
  try:
    opts.update(dict(s.split('=', 1) for s in _option if '=' in s))
  except ValueError:
    raise AzkabanError('Invalid `--option` flag.')
  return opts
Example #5
0
 def test_str(self):
   job = Job({'foo': {'bar': FlowProperty(mode1='a', mode2='b')}})
   with temppath() as tpath:
     job.build(path=tpath)
     eq_(read_properties(tpath), {'foo.bar': '${flow.property.0}'})
Example #6
0
 def test_str(self):
     job = Job({'foo': {'bar': FlowProperty(mode1='a', mode2='b')}})
     with temppath() as tpath:
         job.build(path=tpath)
         eq_(read_properties(tpath), {'foo.bar': '${flow.property.0}'})