@log_calls<EOL><INDENT>def write_file_chunk(self, target, pos, chunk, body):<DEDENT>
fd = os.open(target, os.O_CREAT | os.O_WRONLY)<EOL>try:<EOL><INDENT>os.lseek(fd, pos, os.SEEK_SET)<EOL>data = body.read(chunk)<EOL>num_bytes_written = os.write(fd, data)<EOL>if(num_bytes_written != len(data)):<EOL><INDENT>raise RetryFailure('<STR_LIT>' % (num_bytes_written, sys.getsizeof(data)))<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>os.close(fd)<EOL><DEDENT>
Write local file chunk