Revision: 23290
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23290
Author:   theeth
Date:     2009-09-16 21:47:58 +0200 (Wed, 16 Sep 2009)

Log Message:
-----------
fix bugs with file transfer

Modified Paths:
--------------
    trunk/blender/release/io/netrender/master.py
    trunk/blender/release/io/netrender/slave.py
    trunk/blender/release/io/netrender/utils.py

Modified: trunk/blender/release/io/netrender/master.py
===================================================================
--- trunk/blender/release/io/netrender/master.py        2009-09-16 19:36:17 UTC 
(rev 23289)
+++ trunk/blender/release/io/netrender/master.py        2009-09-16 19:47:58 UTC 
(rev 23290)
@@ -323,8 +323,9 @@
                                        
                                        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 @@
                                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 @@
                                        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

Modified: trunk/blender/release/io/netrender/slave.py
===================================================================
--- trunk/blender/release/io/netrender/slave.py 2009-09-16 19:36:17 UTC (rev 
23289)
+++ trunk/blender/release/io/netrender/slave.py 2009-09-16 19:47:58 UTC (rev 
23290)
@@ -26,12 +26,12 @@
                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 @@
                                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 = []
                                

Modified: trunk/blender/release/io/netrender/utils.py
===================================================================
--- trunk/blender/release/io/netrender/utils.py 2009-09-16 19:36:17 UTC (rev 
23289)
+++ trunk/blender/release/io/netrender/utils.py 2009-09-16 19:47:58 UTC (rev 
23290)
@@ -59,8 +59,8 @@
                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)


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to