Пример #1
0
    def _fix_opt(self, opt_key, opt_value, source):
        """Check sh_bin"""
        opt_value = super(MRJobBinRunner, self)._fix_opt(
            opt_key, opt_value, source)

        # check that sh_bin doesn't have too many args
        if opt_key == 'sh_bin':
            # opt_value is usually a string, combiner makes it a list of args
            sh_bin = combine_cmds(opt_value)

            # empty sh_bin just means to use the default, see #1926

            # make these hard requirements in v0.7.0?
            if len(sh_bin) > 1 and not os.path.isabs(sh_bin[0]):
                log.warning('sh_bin (from %s) should use an absolute path'
                            ' if you want it to take arguments' % source)
            elif len(sh_bin) > 2:
                log.warning('sh_bin (from %s) should not take more than one'
                            ' argument' % source)

        return opt_value
Пример #2
0
 def test_convert_to_list(self):
     assert_equal(combine_cmds('sort', ('grep', '-E')), ['grep', '-E'])
Пример #3
0
 def test_parse_empty_string(self):
     assert_equal(combine_cmds(''), [])
Пример #4
0
 def test_parse_string(self):
     assert_equal(combine_cmds('sort', 'grep', 'cat'), ['cat'])
     assert_equal(combine_cmds(['python'], 'python -S'), ['python', '-S'])
Пример #5
0
 def test_all_None(self):
     assert_equal(combine_cmds(None, None, None), None)
Пример #6
0
 def test_picks_last_value(self):
     assert_equal(combine_cmds(['sort'], ['grep'], ['cat']), ['cat'])
Пример #7
0
 def test_empty(self):
     assert_equal(combine_cmds(), None)
Пример #8
0
 def test_all_None(self):
     self.assertEqual(combine_cmds(None, None, None), None)
Пример #9
0
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)
Пример #10
0
 def test_unicode(self):
     self.assertEqual(combine_cmds(u"wunderbar!"), ["wunderbar!"])
Пример #11
0
 def test_convert_to_list(self):
     self.assertEqual(combine_cmds("sort", ("grep", "-E")), ["grep", "-E"])
Пример #12
0
 def test_parse_empty_string(self):
     self.assertEqual(combine_cmds(""), [])
Пример #13
0
 def test_parse_string(self):
     self.assertEqual(combine_cmds("sort", "grep", "cat"), ["cat"])
     self.assertEqual(combine_cmds(["python"], "python -S"), ["python", "-S"])
Пример #14
0
 def test_picks_last_value(self):
     self.assertEqual(combine_cmds(["sort"], ["grep"], ["cat"]), ["cat"])
Пример #15
0
 def test_unicode(self):
     self.assertEqual(combine_cmds(u'wunderbar!'), ['wunderbar!'])
Пример #16
0
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)