Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding m_dir to lauch_multiprocess and removing time elapsed error #497

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions fireworks/features/multi_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def ping_multilaunch(port, stop_event):


def rapidfire_process(
fworker, nlaunches, sleep, loglvl, port, node_list, sub_nproc, timeout, running_ids_dict, local_redirect
fworker, nlaunches, sleep, loglvl, port, node_list, sub_nproc, timeout, running_ids_dict, local_redirect, m_dir
):
"""
Initializes shared data with multiprocessing parameters and starts a rapidfire.
Expand Down Expand Up @@ -75,7 +75,7 @@ def rapidfire_process(
rapidfire(
launchpad,
fworker=fworker,
m_dir=None,
m_dir=m_dir,
nlaunches=nlaunches,
max_loops=-1,
sleep_time=sleep,
Expand All @@ -91,19 +91,20 @@ def rapidfire_process(
# Some other sub jobs are still running

# Update the timeout according to the already elapsed time
time_elapsed = time.time() - process_start_time
timeout_left = timeout - time_elapsed
if timeout is not None:
time_elapsed = time.time() - process_start_time
timeout_left = timeout - time_elapsed

# Stand down if there is less than 3% of the time left
if timeout_left < 0.03 * timeout:
log_multi(
l_logger,
(
f"Remaining time {timeout_left}s is less than 3% of the original timeout "
f"{timeout}s - standing down"
),
)
break
# Stand down if there is less than 3% of the time left
if timeout_left < 0.03 * timeout:
log_multi(
l_logger,
(
f"Remaining time {timeout_left}s is less than 3% of the original timeout "
f"{timeout}s - standing down"
),
)
break

log_multi(l_logger, f"Sleeping for {sleep_time} secs before resubmit sub job")
time.sleep(sleep_time)
Expand Down Expand Up @@ -135,6 +136,7 @@ def start_rockets(
timeout=None,
running_ids_dict=None,
local_redirect=False,
m_dir=None,
):
"""
Create each sub job and start a rocket launch in each one.
Expand All @@ -156,7 +158,7 @@ def start_rockets(
processes = [
Process(
target=rapidfire_process,
args=(fworker, nlaunches, sleep, loglvl, port, nl, sub_nproc, timeout, running_ids_dict, local_redirect),
args=(fworker, nlaunches, sleep, loglvl, port, nl, sub_nproc, timeout, running_ids_dict, local_redirect, m_dir),
)
for nl, sub_nproc in zip(node_lists, sub_nproc_list)
]
Expand Down Expand Up @@ -205,6 +207,7 @@ def launch_multiprocess(
timeout=None,
exclude_current_node=False,
local_redirect=False,
m_dir=None
):
"""
Launch the jobs in the job packing mode.
Expand Down Expand Up @@ -252,6 +255,7 @@ def launch_multiprocess(
timeout=timeout,
running_ids_dict=running_ids_dict,
local_redirect=local_redirect,
m_dir=m_dir
)
FWData().Running_IDs = running_ids_dict

Expand Down