diff --git a/lib/workload/stateless/stacks/data-migrate/data_mover/cli.py b/lib/workload/stateless/stacks/data-migrate/data_mover/cli.py index 2c3d7ba78..6aef6587a 100644 --- a/lib/workload/stateless/stacks/data-migrate/data_mover/cli.py +++ b/lib/workload/stateless/stacks/data-migrate/data_mover/cli.py @@ -9,6 +9,15 @@ logger.setLevel(logging.DEBUG) +def main(): + try: + cli(standalone_mode=False) + sys.exit(0) + except Exception as e: + DataMover.send_failure(str(e)) + sys.exit(1) + + @click.group() def cli(): pass @@ -58,9 +67,4 @@ def copy(source, destination): if __name__ == "__main__": - try: - cli(standalone_mode=False) - sys.exit(0) - except Exception as e: - DataMover.send_failure(str(e)) - sys.exit(1) + main() diff --git a/lib/workload/stateless/stacks/data-migrate/data_mover/data_mover.py b/lib/workload/stateless/stacks/data-migrate/data_mover/data_mover.py index 7b616bde0..24fa56730 100644 --- a/lib/workload/stateless/stacks/data-migrate/data_mover/data_mover.py +++ b/lib/workload/stateless/stacks/data-migrate/data_mover/data_mover.py @@ -41,14 +41,15 @@ def sync(self): out = subprocess.run( ["aws", "s3", "sync", self.source, self.destination], check=True, - # 1 day timeout=self.timeout, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, ) - self.logger.info(out.stdout) + self.logger.info(str(out.stdout)) - self.output += out.stdout or "" + self.output += str(out.stdout) or "" - if out.stdout is not None: + if out.stdout != b"": raise Exception("failed to sync - non-empty output") def delete(self): @@ -60,12 +61,13 @@ def delete(self): out = subprocess.run( ["aws", "s3", "rm", "--recursive", self.source], check=True, - # 1 day timeout=self.timeout, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, ) - self.logger.info(out.stdout) + self.logger.info(str(out.stdout)) - self.output += out.stdout or "" + self.output += str(out.stdout) or "" def send_output(self): """ diff --git a/lib/workload/stateless/stacks/data-migrate/poetry.lock b/lib/workload/stateless/stacks/data-migrate/poetry.lock index 2b73ac6a9..d47baea65 100644 --- a/lib/workload/stateless/stacks/data-migrate/poetry.lock +++ b/lib/workload/stateless/stacks/data-migrate/poetry.lock @@ -2,17 +2,17 @@ [[package]] name = "boto3" -version = "1.35.71" +version = "1.35.72" description = "The AWS SDK for Python" optional = false python-versions = ">=3.8" files = [ - {file = "boto3-1.35.71-py3-none-any.whl", hash = "sha256:e2969a246bb3208122b3c349c49cc6604c6fc3fc2b2f65d99d3e8ccd745b0c16"}, - {file = "boto3-1.35.71.tar.gz", hash = "sha256:3ed7172b3d4fceb6218bb0ec3668c4d40c03690939c2fca4f22bb875d741a07f"}, + {file = "boto3-1.35.72-py3-none-any.whl", hash = "sha256:410bb4ec676c57ee9c3c7824b7b1a3721584f18f8ee8ccc8e8ecdf285136b77f"}, + {file = "boto3-1.35.72.tar.gz", hash = "sha256:f9fc94413a959c388b1654c6687a5193293f3c69f8d0af3b86fd48b4096a23f3"}, ] [package.dependencies] -botocore = ">=1.35.71,<1.36.0" +botocore = ">=1.35.72,<1.36.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.10.0,<0.11.0" @@ -21,13 +21,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.71" +version = "1.35.72" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.35.71-py3-none-any.whl", hash = "sha256:fc46e7ab1df3cef66dfba1633f4da77c75e07365b36f03bd64a3793634be8fc1"}, - {file = "botocore-1.35.71.tar.gz", hash = "sha256:f9fa058e0393660c3fe53c1e044751beb64b586def0bd2212448a7c328b0cbba"}, + {file = "botocore-1.35.72-py3-none-any.whl", hash = "sha256:7412877c3f766a1bfd09236e225ce1f0dc2c35e47949ae423e56e2093c8fa23a"}, + {file = "botocore-1.35.72.tar.gz", hash = "sha256:6b5fac38ef7cfdbc7781a751e0f78833ccb9149ba815bc238b1dbb75c90fbae5"}, ] [package.dependencies] diff --git a/lib/workload/stateless/stacks/data-migrate/pyproject.toml b/lib/workload/stateless/stacks/data-migrate/pyproject.toml index f65816583..6ef06a639 100644 --- a/lib/workload/stateless/stacks/data-migrate/pyproject.toml +++ b/lib/workload/stateless/stacks/data-migrate/pyproject.toml @@ -20,4 +20,4 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -dm = "data_mover.cli:cli" +dm = "data_mover.cli:main"