Skip to content

Commit

Permalink
Merge pull request #1606 from totvs/hotfix/num_exec
Browse files Browse the repository at this point in the history
change post_exec ConfigLoader call
  • Loading branch information
renanllisboa authored Dec 2, 2024
2 parents a14d12b + 0b8989d commit 6696098
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tir/technologies/core/numexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import os


class NumExec(ConfigLoader):
class NumExec():

def __init__(self):
super().__init__()
self.config = ConfigLoader()

def post_exec(self, url, numexec_folder):

Expand All @@ -34,20 +34,20 @@ def post_exec(self, url, numexec_folder):
time.sleep(12)

if error:
response = str(f"STATUS: {status} Url: {url} ID: {self.num_exec} Error: {error}")
response = str(f"STATUS: {status} Url: {url} ID: {self.config.num_exec} Error: {error}")
else:
response = str(f"STATUS: {status} Url: {url} ID: {self.num_exec}")
response = str(f"STATUS: {status} Url: {url} ID: {self.config.num_exec}")

logger().debug(response)
if status not in success_response:

try:
path = Path(self.log_folder, numexec_folder)
path = Path(self.config.log_folder, numexec_folder)
os.makedirs(path)
except OSError:
pass

with open(Path(path, f"{self.num_exec}_TIR_{strftime}.txt"), "w") as json_log:
with open(Path(path, f"{self.config.num_exec}_TIR_{strftime}.txt"), "w") as json_log:
json_log.write(response)

return status in success_response
Expand All @@ -63,7 +63,7 @@ def send_request(self, url):
"https": None,
}

data = {'num_exec': self.num_exec, 'ip_exec': self.ipExec}
data = {'num_exec': self.config.num_exec, 'ip_exec': self.config.ipExec}

response = requests.post(url.strip(), json=data, proxies=proxies)

Expand Down

0 comments on commit 6696098

Please sign in to comment.