def dataProvider_testBuildInput(self): pBuildInputDep = Proc() pBuildInputDep.props['channel'] = [] pBuildInput = Proc() pBuildInput.depends = pBuildInputDep yield pBuildInput, {}, {} yield pBuildInput, 'a,b', {'a': {'data': [], 'type': 'var'}, 'b': {'data': [], 'type': 'var'}} yield pBuildInput, 'a:unknowntype', {}, ProcInputError, 'Unknown input type' pBuildInputDep1 = Proc() pBuildInputDep1.props['channel'] = Channel.create([1,2]) pBuildInputDep2 = Proc() pBuildInputDep2.props['channel'] = Channel.create([3,4]) pBuildInput1 = Proc() pBuildInput1.depends = pBuildInputDep1, pBuildInputDep2 yield pBuildInput1, 'a,b', {'a': {'data': [1,2], 'type': 'var'}, 'b': {'data': [3,4], 'type': 'var'}} pBuildInput2 = Proc() pBuildInput2.depends = pBuildInputDep1, pBuildInputDep2 yield pBuildInput2, 'a', {'a': {'data': [1,2], 'type': 'var'}}, None, None, ['Not all data are used as input, 1 column(s) wasted.'] pBuildInput3 = Proc() pBuildInput3.depends = pBuildInputDep1, pBuildInputDep2 yield pBuildInput2, {'a,b,c': lambda ch1, ch2: ch1.cbind(ch2)}, {'a': {'data': [1,2], 'type': 'var'}, 'b': {'data': [3,4], 'type': 'var'}, 'c': {'data': ['',''], 'type': 'var'}}, None, None, ['No data found for input key "c", use empty strings/lists instead.'] pBuildInput4 = Proc() yield pBuildInput4, {'a': [1], 'b': 2, 'c': [1,2], 'd:files':[[self.testdir, self.testdir]]}, { 'a': {'data': [1,1], 'type': 'var'}, 'b': {'data': [2,2], 'type': 'var'}, 'c': {'data': [1,2], 'type': 'var'}, 'd': {'data': [[self.testdir,self.testdir], [self.testdir,self.testdir]], 'type': 'files'}, } pBuildInput5 = Proc() pBuildInput5.ppldir = self.testdir pBuildInput5.input = {'a': ['h"i\'nihao'], 'b': 2, 'c': [1,2], 'd:files':[[self.testdir, self.testdir]]} with helpers.log2str(): pBuildInput5._buildInput() pBuildInput5._buildProps() pBuildInput5._saveSettings() pBuildInput5.props['resume'] = 'skip+' yield pBuildInput5, {}, { 'a': {'data': ['h"i\'nihao','h"i\'nihao'], 'type': 'var'}, 'b': {'data': [2,2], 'type': 'var'}, 'c': {'data': [1,2], 'type': 'var'}, 'd': {'data': [[self.testdir,self.testdir], [self.testdir,self.testdir]], 'type': 'files'}, } pBuildInput6 = Proc() pBuildInput6.ppldir = self.testdir pBuildInput6.props['resume'] = 'skip+' yield pBuildInput6, {}, {}, ProcInputError, 'Cannot parse input for skip\+/resume process, no such file:'
def dataProvider_testBuildJobs(self): pBuildJobs = Proc() pBuildJobs.ppldir = self.testdir infile1 = path.join(self.testdir, 'pBuildJobs-in1.txt') infile2 = path.join(self.testdir, 'pBuildJobs-in2.txt') helpers.writeFile(infile1) helpers.writeFile(infile2) pBuildJobs.input = {'a': 1, 'b:file': [infile1, infile2], 'c:files': [[infile1, infile2]]} pBuildJobs.output = 'out:file:{{in.b | fn}}-{{in.a}}.out' pBuildJobs.script = 'echo {{in.a}} > {{out.out}}' with helpers.log2str(levels = 'all') as (out, err): pBuildJobs._buildProps () pBuildJobs._buildInput () pBuildJobs._buildProcVars () #pBuildJobs._buildBrings () pBuildJobs._buildOutput() pBuildJobs._buildScript() yield pBuildJobs, 2, [ path.join(pBuildJobs.workdir, '1', 'output', 'pBuildJobs-in1-1.out'), path.join(pBuildJobs.workdir, '2', 'output', 'pBuildJobs-in2-1.out') ], ['out'], [ 'INPUT', '/2] a => 1', '/2] b => %s' % pBuildJobs.workdir, # '/2] _b => %s' % testdir, '/2] c => [ %s' % pBuildJobs.workdir, '/2] %s' % pBuildJobs.workdir, # '/2] _c => [%s' % testdir, # '/2] %s' % testdir, 'OUTPUT', '/2] out => %s' % pBuildJobs.workdir ] pBuildJobs1 = Proc() pBuildJobs1.ppldir = self.testdir yield pBuildJobs1, 0, [], [], [ 'WARNING', 'No data found for jobs, process will be skipped.' ]