diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-09-16 23:47:58 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-09-16 23:47:58 +0400 |
commit | 6e4d4a8a1266834ac5ec7e079c734563caa14628 (patch) | |
tree | 92ae2aadb68d4a9eca81ffec19d0976224c217cd /release | |
parent | b6c6610630220de3fd39ee0c117451e436c889e0 (diff) |
fix bugs with file transfer
Diffstat (limited to 'release')
-rw-r--r-- | release/io/netrender/master.py | 11 | ||||
-rw-r--r-- | release/io/netrender/slave.py | 8 | ||||
-rw-r--r-- | release/io/netrender/utils.py | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/release/io/netrender/master.py b/release/io/netrender/master.py index 13e8b399d6c..29cec4e2232 100644 --- a/release/io/netrender/master.py +++ b/release/io/netrender/master.py @@ -323,8 +323,9 @@ class RenderHandler(http.server.BaseHTTPRequestHandler): if render_file: self.server.stats("", "Sending file to render node") - f = open(render_file.path, 'rb') + f = open(render_file.filepath, 'rb') + self.send_head() shutil.copyfileobj(f, self.wfile) f.close() @@ -444,7 +445,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler): render_file = job.files_map.get(job_file, None) if render_file: - main_file = job.files[0] + main_file = job.files[0][0] # filename of the first file main_path, main_name = os.path.split(main_file) @@ -462,12 +463,12 @@ class RenderHandler(http.server.BaseHTTPRequestHandler): f.close() del buf - render_file.path = file_path # set the new path + render_file.filepath = file_path # set the new path if job.testStart(): - self.send_head(headers=headers) + self.send_head(http.client.OK) else: - self.send_head(http.client.ACCEPTED, headers=headers) + self.send_head(http.client.ACCEPTED) else: # invalid file self.send_head(http.client.NO_CONTENT) else: # job not found diff --git a/release/io/netrender/slave.py b/release/io/netrender/slave.py index cec5439fc63..3a4e77abc54 100644 --- a/release/io/netrender/slave.py +++ b/release/io/netrender/slave.py @@ -26,12 +26,12 @@ def testCancel(conn, job_id): else: return False -def testFile(conn, JOB_PREFIX, file_path, main_path = None): +def testFile(conn, job_id, slave_id, JOB_PREFIX, file_path, main_path = None): job_full_path = prefixPath(JOB_PREFIX, file_path, main_path) if not os.path.exists(job_full_path): temp_path = JOB_PREFIX + "slave.temp.blend" - conn.request("GET", "file", headers={"job-id": job.id, "slave-id":slave_id, "job-file":file_path}) + conn.request("GET", "file", headers={"job-id": job_id, "slave-id":slave_id, "job-file":file_path}) response = conn.getresponse() if response.status != http.client.OK: @@ -86,14 +86,14 @@ def render_slave(engine, scene): job_path = job.files[0][0] # data in files have format (path, start, end) main_path, main_file = os.path.split(job_path) - job_full_path = testFile(conn, JOB_PREFIX, job_path) + job_full_path = testFile(conn, job.id, slave_id, JOB_PREFIX, job_path) print("Fullpath", job_full_path) print("File:", main_file, "and %i other files" % (len(job.files) - 1,)) engine.update_stats("", "Render File", main_file, "for job", job.id) for file_path, start, end in job.files[1:]: print("\t", file_path) - testFile(conn, JOB_PREFIX, file_path, main_path) + testFile(conn, job.id, slave_id, JOB_PREFIX, file_path, main_path) frame_args = [] diff --git a/release/io/netrender/utils.py b/release/io/netrender/utils.py index 72a29472748..46c2011b188 100644 --- a/release/io/netrender/utils.py +++ b/release/io/netrender/utils.py @@ -59,8 +59,8 @@ def prefixPath(prefix_directory, file_path, prefix_path): if not os.path.exists(full_path): p, n = os.path.split(full_path) - if main_path and p.startswith(main_path): - directory = prefix_directory + p[len(main_path):] + if prefix_path and p.startswith(prefix_path): + directory = prefix_directory + p[len(prefix_path):] full_path = directory + n if not os.path.exists(directory): os.mkdir(directory) |