Skip to content

Commit

Permalink
Introduction of a way to be a worker
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed May 20, 2024
1 parent ad2832d commit f2bb0d6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
8 changes: 7 additions & 1 deletion dead_hosts/launcher/defaults/pyfunceble.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@
"cli_testing.max_workers": 5,
"cli_testing.preload_file": False,
"collection.push": True,
"collection.url_base": "https://collection.dead-hosts.funilrys.com",
"lookup.collection": True,
"cli_testing.chancy_tester": True,
}

PLATFORM_PERSISTENT_CONFIG: dict = {
"cli_testing.display_mode.dots": True,
"cli_testing.max_workers": 1,
"cli_testing.chancy_tester": False,
"cli_testing.testing_mode.platform_contribution": True
}
17 changes: 16 additions & 1 deletion dead_hosts/launcher/orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def __init__(

if self.authorization_handler.is_platform_authorized():
self.run_platform_sync()

if EnvironmentVariableHelper("PLATFORM_WORKER").get_value():
self.run_platform_worker()
elif self.authorization_handler.is_test_authorized():
PyFunceble.facility.ConfigLoader.start()
self.fetch_file_to_test()
Expand Down Expand Up @@ -200,6 +203,18 @@ def fetch_file_to_test(self) -> "Orchestration":

return self

def run_platform_worker(self):
"""
Run a test of the input list.
"""

logging.info("Starting PyFunceble %r ...", PyFunceble.__version__)

Command(f"pyfunceble platform").run_to_stdout()

if not dead_hosts.launcher.defaults.envs.GITHUB_TOKEN:
self.run_end()

def run_test(self):
"""
Run a test of the input list.
Expand Down Expand Up @@ -231,7 +246,7 @@ def run_test(self):
logging.info("Updated all timestamps.")
logging.info("Starting PyFunceble %r ...", PyFunceble.__version__)

Command(f"PyFunceble -f {self.origin_file.path}").run_to_stdout()
Command(f"pyfunceble -f {self.origin_file.path}").run_to_stdout()

if not dead_hosts.launcher.defaults.envs.GITHUB_TOKEN:
self.run_end()
Expand Down
21 changes: 13 additions & 8 deletions dead_hosts/launcher/updater/pyfunceble_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,21 @@ def start(self) -> "PyFuncebleConfigUpdater":
if self.info_manager.ping:
logging.info("Ping names given, appending them to the commit message.")

local_version[
"cli_testing.ci.end_commit_message"
] = self.get_commit_message(
local_version["cli_testing.ci.end_commit_message"],
ping=self.info_manager.get_ping_for_commit(),
local_version["cli_testing.ci.end_commit_message"] = (
self.get_commit_message(
local_version["cli_testing.ci.end_commit_message"],
ping=self.info_manager.get_ping_for_commit(),
)
)

local_version = Merge(
dead_hosts.launcher.defaults.pyfunceble.PERSISTENT_CONFIG
).into(local_version, strict=True)
if not self.info_manager.platform_optout:
local_version = Merge(
dead_hosts.launcher.defaults.pyfunceble.PLATFORM_PERSISTENT_CONFIG
).into(local_version, strict=True)
else:
local_version = Merge(
dead_hosts.launcher.defaults.pyfunceble.PERSISTENT_CONFIG
).into(local_version, strict=True)

if FileHelper(
os.path.join(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests
pyyaml
PyFunceble-dev~=4.0.0b66
PyFunceble-dev~=4.2.0

0 comments on commit f2bb0d6

Please sign in to comment.