Skip to content

Commit

Permalink
Get rid of .stepup/logs subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
tovrstra committed Aug 24, 2024
1 parent 110a2dc commit b6987dd
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 39 deletions.
6 changes: 3 additions & 3 deletions docs/advanced_topics/manual_cleaning.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ If `cleanup` cannot connect to the StepUp director process, it will keep trying

```
Trying to contact StepUp director process.
File ./.stepup/logs/director not found. Waiting 0.1 seconds.
Socket /tmp/stepup-c9a12bau/director read from ./.stepup/logs/director does not exist. Stepup not running? Waiting 0.2 seconds.
Socket /tmp/stepup-c9a12bau/director read from ./.stepup/logs/director does not exist. Stepup not running? Waiting 0.3 seconds.
File ./.stepup/director.log not found. Waiting 0.1 seconds.
Socket /tmp/stepup-c9a12bau/director read from ./.stepup/director.log does not exist. Stepup not running? Waiting 0.2 seconds.
Socket /tmp/stepup-c9a12bau/director read from ./.stepup/director.log does not exist. Stepup not running? Waiting 0.3 seconds.
...
```

Expand Down
2 changes: 1 addition & 1 deletion stepup/core/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ async def wait(self):
def get_socket() -> str:
"""Block until the director socket is known and return it."""
stepup_root = Path(os.getenv("STEPUP_ROOT", "./"))
path_director_log = stepup_root / ".stepup/logs/director"
path_director_log = stepup_root / ".stepup/director.log"
secs = 0
while True:
time.sleep(secs)
Expand Down
2 changes: 1 addition & 1 deletion stepup/core/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async def run_example(srcdir, tmpdir, overwrite_expected=False):
exp = fh.read().rstrip()
pairs.append((path_exp, cur, exp))
finally:
for path_log in sorted(workdir.glob(".stepup/logs/*")):
for path_log in sorted(workdir.glob(".stepup/*.log")):
print()
print(f"########## {path_log} ##########")
print()
Expand Down
8 changes: 4 additions & 4 deletions stepup/core/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ async def async_main():

# Create dir
dir_stepup = Path(".stepup")
dir_logs = dir_stepup / "logs"
dir_logs.rmtree_p()
dir_logs.makedirs_p()
dir_stepup.makedirs_p()
for path_log in dir_stepup.glob("*.log"):
path_log.remove_p()

with tempfile.TemporaryDirectory(prefix="stepup-") as dir_sockets:
dir_sockets = Path(dir_sockets)
Expand Down Expand Up @@ -92,7 +92,7 @@ async def async_main():
if not args.interactive:
argv.append("--non-interactive")
try:
with open(".stepup/logs/director", "w") as log_file:
with open(".stepup/director.log", "w") as log_file:
process_director = await asyncio.create_subprocess_exec(
sys.executable,
*argv,
Expand Down
2 changes: 1 addition & 1 deletion stepup/core/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def parse_args():
async def async_main():
args = parse_args()
with contextlib.ExitStack() as stack:
ferr = stack.enter_context(open(f".stepup/logs/worker{args.worker_idx}", "w"))
ferr = stack.enter_context(open(f".stepup/worker{args.worker_idx}.log", "w"))
stack.enter_context(contextlib.redirect_stderr(ferr))
print(f"PID {os.getpid()}", file=sys.stderr)
async with ReporterClient.socket(args.reporter_socket) as reporter:
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/amend/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ grep word2 out2.txt
wait

# Restart StepUp without changes
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down Expand Up @@ -78,7 +78,7 @@ wait

# Restart StepUp with changes
echo "word2 and other" > inp2.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_03.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/deferred_glob1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ wait

# Restart the example with a different input
export ENV_VAR_TEST_STEPUP_INP="static/sub/bar.txt"
rm -r .stepup/logs
rm .stepup/*.log
stepup -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
6 changes: 3 additions & 3 deletions tests/cases/env_vars/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cp current_variables.txt current_variables_03.txt

# Change a variable and restart
export ENV_VAR_TEST_STEPUP_DFTHYH="CCCC"
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_b.txt &

# Wait for the director and get its socket.
Expand All @@ -94,7 +94,7 @@ cp current_variables.txt current_variables_04.txt

# unset a variable and restart
unset ENV_VAR_TEST_STEPUP_AWDFTD
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_c.txt &

# Wait for the director and get its socket.
Expand All @@ -121,7 +121,7 @@ wait

# Set a variable again and restart
export ENV_VAR_TEST_STEPUP_AWDFTD="DDDD"
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_d.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/env_vars_amend/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ wait

# Rerstart with changed variable
export ENV_VAR_TEST_STEPUP_SDASFD="BBBB"
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/env_vars_path/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wait

# Restart the example with a different variable
export ENV_VAR_TEST_STEPUP_PREFIX="FOO"
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/error_main_fails/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wait

# Run the example, version 2
cp plan_02.py plan.py
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/no_data/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ wait

# Create file again and restart
cp original.txt data.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_b.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/no_static/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wait

# Start stepup without checking expected output because watchdog file
# order is not reproducible.
rm -r .stepup/logs
rm .stepup/*.log
stepup -w 1 plan.py &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/optional_convert/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ grep raw_03 used.txt

# Restart with a different environment variables
export ENV_VAR_TEST_STEPUP_IDX="1"
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_b.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/permissions_plan_restart/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ wait

# Restart the plan with executable step.py.
chmod +x sub/plan.py
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/permissions_step_restart/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wait

# Restart the plan with executable step.py.
chmod +x step.py
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_blocked/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wait

# Modify a few things and restart
cp plan_unblocked.py plan.py
rm -r .stepup/logs
rm .stepup/*.log
stepup -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_changes/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wait
[[ -f source_01.txt ]] || exit 1

# second with a different plan.
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan_02.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/restart_deferred_glob/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ grep first static/foo.txt
grep first bar.txt

# Run the plan again without any changes.
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down Expand Up @@ -61,7 +61,7 @@ grep first bar.txt

# Run the plan again with changes.
echo second > static/foo.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_03.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_input/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ grep first output.txt

# Run the plan with the second input.
echo second > input.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_nochanges/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wait
[[ -f quadruple.txt ]] || exit 1

# Run the plan.
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_orphan/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ wait
[[ -f bar.txt ]] || exit 1

# Run the plan.
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_outdated_amend/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ grep inp1 copy.txt
rm inp1.txt
echo inp2 > inp2.txt
echo inp2.txt > subs.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/restart_output/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ wait

# Restart StepUp after removing the output.
rm copy.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/static_glob/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ wait
# Modify nglob results and restart
echo "Fourth input" > inp4.txt
rm inp2.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_b.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/static_nglob/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ wait

# Start stepup without checking expected output because watchdog file
# order is not reproducible.
rm -r .stepup/logs
rm .stepup/*.log
stepup -w 1 plan.py &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/static_nglob_partial/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ wait
# Modify nglob results and restart
echo "ty" > tail_y.txt
echo "tz" > tail_z.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_b.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/static_nglob_subdir/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ wait

# Restart with one more input
echo three > sub/inp3.txt
rm -r .stepup/logs
rm .stepup/*.log
stepup -e -w 1 plan.py & # > current_stdout_02.txt &

# Wait for the director and get its socket.
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ async def client(tmpdir) -> Iterator[AsyncRPCClient]:
dir_stepup = Path(".stepup").absolute()
dir_sockects = dir_stepup / "sockets"
dir_sockects.makedirs_p()
dir_logs = dir_stepup / "logs"
dir_logs.makedirs_p()
director_socket_path = dir_sockects / "director"

with open("plan.py", "w") as fh:
Expand Down

0 comments on commit b6987dd

Please sign in to comment.