Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix node cleanup#135

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
demonolock merged 3 commits intomasterfromfix-node-cleanup
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
Add cleanup parameter - clean full dir
  • Loading branch information
vshepard committedJul 1, 2024
commite5184a4166228d1db842e20c42bd1320be9f9648
8 changes: 4 additions & 4 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -912,13 +912,14 @@ def free_port(self):
self._should_free_port = False
release_port(self.port)

def cleanup(self, max_attempts=3):
def cleanup(self, max_attempts=3, full=False):
"""
Stop node if needed and remove its data/logs directory.
NOTE: take a look at TestgresConfig.node_cleanup_full.

Args:
max_attempts: how many times should we try to stop()?
full: clean full base dir

Returns:
This instance of :class:`.PostgresNode`.
Expand All@@ -927,7 +928,7 @@ def cleanup(self, max_attempts=3):
self._try_shutdown(max_attempts)

# choose directory to be removed
if testgres_config.node_cleanup_full:
if testgres_config.node_cleanup_full or full:
rm_dir = self.base_dir # everything
else:
rm_dir = self.data_dir # just data, save logs
Expand DownExpand Up@@ -1655,8 +1656,7 @@ def upgrade_from(self, old_node, options=None, expect_error=False):
"--old-datadir", old_node.data_dir,
"--new-datadir", self.data_dir,
"--old-port", str(old_node.port),
"--new-port", str(self.port),
"--copy"
"--new-port", str(self.port)
]
upgrade_command += options

Expand Down
2 changes: 2 additions & 0 deletionstestgres/operations/local_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -162,6 +162,8 @@ def rmdirs(self, path, ignore_errors=True, retries=3, delay=1):
rmtree(path, ignore_errors=ignore_errors)
if not os.path.exists(path):
return True
except FileNotFoundError:
return True
except Exception as e:
print(f"Error: Failed to remove directory {path} on attempt {attempt + 1}: {e}")
time.sleep(delay)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp