def wal_archive(self, wal_path, concurrency=<NUM_LIT:1>):
<EOL>xlog_dir = os.path.dirname(wal_path)<EOL>segment = WalSegment(wal_path, explicit=True)<EOL>uploader = WalUploader(self.layout, self.creds, self.gpg_key_id)<EOL>group = WalTransferGroup(uploader)<EOL>group.start(segment)<EOL>started = <NUM_LIT:1><EOL>seg_stream = WalSegment.from_ready_archive_status(xlog_dir)<EOL>while started < concurrency:<EOL><INDENT>try:<EOL><INDENT>other_segment = next(seg_stream)<EOL><DEDENT>except StopIteration:<EOL><INDENT>break<EOL><DEDENT>if other_segment.path != wal_path:<EOL><INDENT>group.start(other_segment)<EOL>started += <NUM_LIT:1><EOL><DEDENT><DEDENT>try:<EOL><INDENT>group.join()<EOL><DEDENT>except EnvironmentError as e:<EOL><INDENT>if e.errno == errno.ENOENT:<EOL><INDENT>print(e)<EOL>raise UserException(<EOL>msg='<STR_LIT>',<EOL>detail=('<STR_LIT>'<EOL>.format(e.strerror, repr(e.filename))))<EOL><DEDENT>raise<EOL><DEDENT>
Uploads a WAL file to S3 or Windows Azure Blob Service

This code is intended to typically be called from Postgres's
archive_command feature.