Skip to content

Commit

Permalink
Make repeat accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmannwong committed Jul 2, 2024
1 parent cb0706a commit 5cfa052
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions wellies/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(
**kwargs,
):
self.backup_root = backup_root or None
self.repeat_var = repeat["name"]
self._added_log_tasks = False
variables = kwargs.pop("variables", {})
if self.backup_root:
Expand All @@ -44,7 +43,7 @@ def __init__(
)

with self:
repeat_factory(repeat)
self.repeat_attr = repeat_factory(repeat)

def exit_hook(self):
if not self.backup_root:
Expand Down Expand Up @@ -73,7 +72,7 @@ def _loop_task(self):
script = textwrap.dedent(
f"""
dir=$LOGS_BACKUP_ROOT/$SUITE/$FAMILY
dir_old=${{dir}}.${self.repeat_var}
dir_old=${{dir}}.${self.repeat_attr.name}
[[ -d $dir ]] && mv $dir $dir_old
"""
)
Expand All @@ -93,7 +92,7 @@ def _archive_task(self):
for log in $(ls -d ${{FAMILY}}.*); do
REPEAT_TO_TAR=$(echo $log | awk -F'.' '{{print $NF}}'')
if [[ $REPEAT_TO_TAR -lt ${self.repeat_var} ]]; then
if [[ $REPEAT_TO_TAR -lt ${self.repeat_attr.name} ]]; then
TAR_FILE=${{FAMILY}}_${{REPEAT_TO_TAR}}.tar.gz
tar -czvf $TAR_FILE $log
chmod 644 $TAR_FILE
Expand Down

0 comments on commit 5cfa052

Please sign in to comment.