Commit 5a5269d6 authored by Jerome Mariette's avatar Jerome Mariette

add loading shared components

parent 08ca965e
#
# Copyright (C) 2012 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
\ No newline at end of file
#
# Copyright (C) 2012 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import pickle
from jflow.component import Component
from weaver.function import PythonFunction, ShellFunction
from weaver.abstraction import Merge, Map
from ng6.run import Run
def add_raw_files (run_dump_path, archive_mode, *files_to_save):
import pickle
# load the analysis object
run_dump = open(run_dump_path, "rb")
my_run = pickle.load(run_dump)
run_dump.close()
my_run.add_raw_files(files_to_save, archive_mode)
class AddRawFiles (Component):
def define_parameters(self, runobj, files_to_save, archive_mode):
self.runobj = runobj
self.files_to_save = files_to_save
self.archive_mode = archive_mode
self.stdout = os.path.join(self.output_directory, "addRawFiles.stdout")
def run(self):
run_dump_path = self.get_temporary_file(".dump")
run_dump = open(run_dump_path, "wb")
pickle.dump(self.runobj, run_dump)
run_dump.close()
addraw = PythonFunction(add_raw_files)
addraw(outputs=self.stdout, arguments=[run_dump_path, self.archive_mode, self.files_to_save])
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment