From 2e43923e5822a74cd38177382fcf6a91c4babd65 Mon Sep 17 00:00:00 2001 From: Manjunath PV Date: Thu, 4 Jan 2024 15:24:18 +0530 Subject: [PATCH] reverted minor changes --- covalent_ec2_plugin/assets/infra/main.tf | 2 +- covalent_ec2_plugin/ec2.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/covalent_ec2_plugin/assets/infra/main.tf b/covalent_ec2_plugin/assets/infra/main.tf index 44ccabe..5affced 100644 --- a/covalent_ec2_plugin/assets/infra/main.tf +++ b/covalent_ec2_plugin/assets/infra/main.tf @@ -78,7 +78,7 @@ resource "null_resource" "deps_install" { "echo 'Installing Covalent...'", # TODO: Update to a variable version - "pip install \"covalent==${var.covalent_version}\"", + "pip install \"covalent${var.covalent_version}\"", "chmod +x /tmp/script.sh", "sudo bash /tmp/script.sh", "echo ok" diff --git a/covalent_ec2_plugin/ec2.py b/covalent_ec2_plugin/ec2.py index f90c125..694dc85 100644 --- a/covalent_ec2_plugin/ec2.py +++ b/covalent_ec2_plugin/ec2.py @@ -201,8 +201,8 @@ async def _run_async_subprocess(self, cmd: List[str], cwd=None, log_output: bool return proc, stdout, stderr - def _get_tf_statefile_path(self) -> str: - state_file = f"{self._TF_DIR}/terraform.tfstate" + def _get_tf_statefile_path(self, task_metadata: Dict) -> str: + state_file = f"{self._TF_DIR}/ec2-{task_metadata['dispatch_id']}-{task_metadata['node_id']}.tfstate" return state_file async def _get_tf_output(self, var: str, state_file: str) -> str: @@ -221,7 +221,7 @@ async def setup(self, task_metadata: Dict) -> None: # locks or to ensure that terraform init is run just once) subprocess.run(["terraform init"], cwd=self._TF_DIR, shell=True, check=True) - state_file = self._get_tf_statefile_path() + state_file = self._get_tf_statefile_path(task_metadata) boto_session = boto3.Session(**self.boto_session_options()) profile = boto_session.profile_name @@ -303,7 +303,7 @@ async def teardown(self, task_metadata: Dict) -> None: """ Invokes Terraform to terminate the instance and teardown supporting resources """ - state_file = self._get_tf_statefile_path() + state_file = self._get_tf_statefile_path(task_metadata) if not os.path.exists(state_file): raise FileNotFoundError(