Exemplo n.º 1
0
 async def push(self, src_paths: List[str], container: FileContainer,
                dest_path: str) -> None:
     async with self.stub.push.open() as stream:
         await stream.send_message(
             PushRequest(inner=PushRequest.Inner(
                 bundle_id=file_container_to_bundle_id_deprecated(
                     container),
                 dst_path=dest_path,
                 container=file_container_to_grpc(container),
             )))
         if self.is_local:
             for src_path in src_paths:
                 await stream.send_message(
                     PushRequest(payload=Payload(file_path=src_path)))
             await stream.end()
             await stream.recv_message()
         else:
             await drain_to_stream(
                 stream=stream,
                 generator=stream_map(
                     generate_tar(paths=src_paths,
                                  verbose=self._is_verbose),
                     lambda chunk: PushRequest(payload=Payload(data=chunk)),
                 ),
                 logger=self.logger,
             )
Exemplo n.º 2
0
 async def push(self, src_paths: List[str], bundle_id: str,
                dest_path: str) -> None:
     async with self.get_stub() as stub, stub.push.open() as stream:
         await stream.send_message(
             PushRequest(inner=PushRequest.Inner(bundle_id=bundle_id,
                                                 dst_path=dest_path)))
         if none_throws(self.companion_info).is_local:
             for src_path in src_paths:
                 await stream.send_message(
                     PushRequest(payload=Payload(file_path=src_path)))
             await stream.end()
             await stream.recv_message()
         else:
             await drain_to_stream(
                 stream=stream,
                 generator=stream_map(
                     generate_tar(paths=src_paths),
                     lambda chunk: PushRequest(payload=Payload(data=chunk)),
                 ),
                 logger=self.logger,
             )