1
0
Fork 0
mirror of https://github.com/Findus23/rebound-collisions.git synced 2024-09-19 15:53:48 +02:00

better process title

This commit is contained in:
Lukas Winkler 2021-06-26 20:42:41 +02:00
parent eaefc69be0
commit e2e1c54e0f
Signed by: lukas
GPG key ID: 54DE4D798D244853
2 changed files with 7 additions and 2 deletions

View file

@ -36,9 +36,13 @@ def process_friendlyness(fn: Path) -> None:
if socket.gethostname() == "standpc": if socket.gethostname() == "standpc":
# only handle other computers specially # only handle other computers specially
return return
setproctitle(f"[{fn.stem}] [rebound-watersim] read /home/winklerl23/sim-info.txt for more information") set_process_title(fn, 0, 0)
os.nice(5) os.nice(5)
def set_process_title(fn: Path, progress: float, bodies: int) -> None:
setproctitle(f"watersim [{fn.stem}] {progress * 100:.2f}% finished, {bodies} bodies")
def is_ci() -> bool: def is_ci() -> bool:
return "CI" in os.environ return "CI" in os.environ

View file

@ -15,7 +15,7 @@ from scipy.constants import astronomical_unit, mega, year
from extradata import ExtraData, ParticleData from extradata import ExtraData, ParticleData
from merge import merge_particles from merge import merge_particles
from utils import unique_hash, filename_from_argv, innermost_period, total_momentum, process_friendlyness, total_mass, \ from utils import unique_hash, filename_from_argv, innermost_period, total_momentum, process_friendlyness, total_mass, \
third_kepler_law, solar_radius, git_hash, check_heartbeat_needs_recompile, PlanetaryRadius third_kepler_law, solar_radius, git_hash, check_heartbeat_needs_recompile, PlanetaryRadius, set_process_title
MIN_TIMESTEP_PER_ORBIT = 20 MIN_TIMESTEP_PER_ORBIT = 20
@ -213,6 +213,7 @@ def main(fn: Path, testrun=False):
while t <= tmax: while t <= tmax:
print() print()
print(f"{t / tmax * 100:.2f}%") print(f"{t / tmax * 100:.2f}%")
set_process_title(fn, t / tmax, sim.N)
try: try:
print(f"integrating until {t}") print(f"integrating until {t}")
sim.integrate(t, exact_finish_time=0) sim.integrate(t, exact_finish_time=0)