Revision: 23094 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23094 Author: theeth Date: 2009-09-09 22:56:49 +0200 (Wed, 09 Sep 2009)
Log Message: ----------- support for external images, blacklisting slaves on errors and proper job termination on cancel Modified Paths: -------------- branches/blender2.5/blender/release/io/netrender/client.py branches/blender2.5/blender/release/io/netrender/master.py branches/blender2.5/blender/release/io/netrender/slave.py Modified: branches/blender2.5/blender/release/io/netrender/client.py =================================================================== --- branches/blender2.5/blender/release/io/netrender/client.py 2009-09-09 19:59:52 UTC (rev 23093) +++ branches/blender2.5/blender/release/io/netrender/client.py 2009-09-09 20:56:49 UTC (rev 23094) @@ -26,6 +26,9 @@ if job_name == "[default]": job_name = name + ########################### + # LIBRARIES + ########################### for lib in bpy.data.libraries: lib_path = lib.filename @@ -34,11 +37,13 @@ job.addFile(lib_path) + ########################### + # POINT CACHES + ########################### + root, ext = os.path.splitext(name) cache_path = path + os.sep + "blendcache_" + root + os.sep # need an API call for that - print("cache:", cache_path) - if os.path.exists(cache_path): caches = {} pattern = re.compile("([a-zA-Z0-9]+)_([0-9]+)_[0-9]+\.bphys") @@ -80,8 +85,15 @@ previous_frame = previous_item[0] job.addFile(cache_path + current_file, previous_frame + 1, next_frame - 1) - print(job.files) + ########################### + # IMAGES + ########################### + for image in bpy.data.images: + if image.source == "FILE" and not image.packed_file: + job.addFile(image.filename) + # print(job.files) + job.name = job_name for slave in scene.network_render.slaves_blacklist: Modified: branches/blender2.5/blender/release/io/netrender/master.py =================================================================== --- branches/blender2.5/blender/release/io/netrender/master.py 2009-09-09 19:59:52 UTC (rev 23093) +++ branches/blender2.5/blender/release/io/netrender/master.py 2009-09-09 20:56:49 UTC (rev 23094) @@ -477,33 +477,43 @@ print("writing result file") self.server.stats("", "Receiving render result") - job_id = self.headers['job-id'] + slave_id = self.headers['slave-id'] - job = self.server.getJobByID(job_id) + slave = self.server.updateSlave(slave_id) - if job: - job_frame = int(self.headers['job-frame']) - job_result = int(self.headers['job-result']) - job_time = float(self.headers['job-time']) + if slave: # only if slave id is valid + job_id = self.headers['job-id'] - if job_result == DONE: - length = int(self.headers['content-length']) - buf = self.rfile.read(length) - f = open(job.save_path + "%04d" % job_frame + ".exr", 'wb') - f.write(buf) - f.close() + job = self.server.getJobByID(job_id) + + if job: + job_frame = int(self.headers['job-frame']) + job_result = int(self.headers['job-result']) + job_time = float(self.headers['job-time']) - del buf + frame = job[job_frame] - job = self.server.getJobByID(job_id) - frame = job[job_frame] - frame.status = job_result - frame.time = job_time - - self.server.updateSlave(self.headers['slave-id']) - - self.send_head() - else: # job not found + if job_result == DONE: + length = int(self.headers['content-length']) + buf = self.rfile.read(length) + f = open(job.save_path + "%04d" % job_frame + ".exr", 'wb') + f.write(buf) + f.close() + + del buf + elif job_result == ERROR: + # blacklist slave on this job on error + job.blacklist.append(slave.id) + + frame.status = job_result + frame.time = job_time + + self.server.updateSlave(self.headers['slave-id']) + + self.send_head() + else: # job not found + self.send_head(http.client.NO_CONTENT) + else: # invalid slave id self.send_head(http.client.NO_CONTENT) # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- elif self.path == "log": Modified: branches/blender2.5/blender/release/io/netrender/slave.py =================================================================== --- branches/blender2.5/blender/release/io/netrender/slave.py 2009-09-09 19:59:52 UTC (rev 23093) +++ branches/blender2.5/blender/release/io/netrender/slave.py 2009-09-09 20:56:49 UTC (rev 23094) @@ -119,6 +119,9 @@ run_t = current_t if cancelled: + # kill process if needed + if process.poll() == None: + process.terminate() continue # to next frame total_t = time.time() - start_t _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs