Added Workflow.get_data_file_name() which returns the full path to a given

data file, or None if the file does not exist. This is tested in the test
workflow.
This commit is contained in:
2007-02-28 14:56:24 +00:00
parent 934640ea62
commit 89636962a7
2 changed files with 30 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ class TestWorkflow (workflow.Workflow):
load = workflow.Stage('load', 'Load Data')
load.add_function(CelFileImportFunction())
load.add_function(DataLoadTestFunction(self))
load.add_function(TestDataFunction())
load.add_function(DatasetLoadFunction())
load.add_function(SelectFunction())
@@ -257,6 +258,22 @@ class CelFileImportFunction(workflow.Function):
chooser.destroy()
class DataLoadTestFunction(workflow.Function):
def __init__(self, wf):
workflow.Function.__init__(self, 'datadirload', 'Load from datadir')
self._wf = wf
def run(self):
print self._wf.get_data_file_name('smoker-x.ftsv')
fn = self._wf.get_data_file_name('smoker-x.ftsv')
if fn:
fd = open(fn)
ds = dataset.read_ftsv(fd)
return [ds]
else:
print "Cannot find file %s" % fn
return []
class PCAFunction(workflow.Function):
"""Generic PCA function."""
def __init__(self, wf):