Skip to content

Commit d872fe9

Browse files
committed
Fix: Script generation for pyflow resource
1 parent 7ab51b7 commit d872fe9

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

pyflow/resource.py

+5-27
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,8 @@ def get_resource(self, filename):
8080

8181
return []
8282

83-
def install_file_stub(self, target):
84-
"""
85-
Installs any data associated with the resource object that is going to be deployed from the **ecFlow** server.
86-
87-
Parameters:
88-
target(Deployment): The target deployment where the resource data should be installed.
89-
"""
9083

91-
"""
92-
n.b. If a resource does not need to save data at deployment time, it should not do so (e.g. WebResource)
93-
"""
94-
# Install path is for the suite, so we don't need to include the suite name
95-
assert self.fullname.count("/") > 1
96-
subpath = self.fullname[self.fullname.find("/", 1) + 1 :]
97-
98-
self._server_filename = os.path.join(
99-
target.files_install_path(), subpath, self.name
100-
)
101-
102-
super().install_file_stub(target)
103-
104-
self.save_data(target, self._server_filename)
105-
106-
def build_script(self):
84+
def generate_script(self):
10785
"""
10886
Returns the installer script for the data resource.
10987
@@ -128,7 +106,7 @@ def build_script(self):
128106
for h in self._hosts:
129107
lines += h.copy_file_to(self._server_filename, self.location()).split("\n")
130108

131-
return lines
109+
return lines, []
132110

133111
def location(self):
134112
"""
@@ -141,6 +119,7 @@ def location(self):
141119
return os.path.join(self._resource_directory, self.name)
142120

143121

122+
144123
class DataResource(Resource):
145124
"""
146125
Provides a data resource to be deployed at suite generation time.
@@ -206,9 +185,8 @@ class FileResource(Resource):
206185
"""
207186

208187
def __init__(self, name, hosts, source_file):
209-
self._source = source_file
210-
211188
super().__init__(name, hosts)
189+
self._server_filename = source_file
212190

213191
def md5(self):
214192
"""
@@ -230,7 +208,7 @@ def data(self):
230208
The resource data.
231209
"""
232210

233-
with open(self._source, "rb") as f:
211+
with open(self._server_filename, "rb") as f:
234212
return f.read()
235213

236214
def save_data(self, target, filename):

0 commit comments

Comments
 (0)