diff --git a/pyflow/resource.py b/pyflow/resource.py index 6d4d01b..4e5fe9b 100644 --- a/pyflow/resource.py +++ b/pyflow/resource.py @@ -80,30 +80,8 @@ def get_resource(self, filename): return [] - def install_file_stub(self, target): - """ - Installs any data associated with the resource object that is going to be deployed from the **ecFlow** server. - - Parameters: - target(Deployment): The target deployment where the resource data should be installed. - """ - """ - n.b. If a resource does not need to save data at deployment time, it should not do so (e.g. WebResource) - """ - # Install path is for the suite, so we don't need to include the suite name - assert self.fullname.count("/") > 1 - subpath = self.fullname[self.fullname.find("/", 1) + 1 :] - - self._server_filename = os.path.join( - target.files_install_path(), subpath, self.name - ) - - super().install_file_stub(target) - - self.save_data(target, self._server_filename) - - def build_script(self): + def generate_script(self): """ Returns the installer script for the data resource. @@ -128,7 +106,7 @@ def build_script(self): for h in self._hosts: lines += h.copy_file_to(self._server_filename, self.location()).split("\n") - return lines + return lines, [] def location(self): """ @@ -141,6 +119,7 @@ def location(self): return os.path.join(self._resource_directory, self.name) + class DataResource(Resource): """ Provides a data resource to be deployed at suite generation time. @@ -206,9 +185,8 @@ class FileResource(Resource): """ def __init__(self, name, hosts, source_file): - self._source = source_file - super().__init__(name, hosts) + self._server_filename = source_file def md5(self): """ @@ -230,7 +208,7 @@ def data(self): The resource data. """ - with open(self._source, "rb") as f: + with open(self._server_filename, "rb") as f: return f.read() def save_data(self, target, filename):