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

Added splitter.py to split queries #25

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
58 changes: 58 additions & 0 deletions copy_files_from_s1904.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import os
import subprocess
import re

# Define the directory containing the folders
base_dir = "data/dbs"

# Define the remote base paths and the local base paths
remote_dbg_base_path = "[email protected]:/home/yizhou7/mariposa/dbg"
local_dbg_base_path = "/home/amarshah/mariposa_fixed/mariposa/dbg"

remote_proj_base_path = "[email protected]:/home/yizhou7/mariposa/data/projs"
local_proj_base_path = "/home/amarshah/mariposa_fixed/mariposa/data/projs"

remote_filtered_base_path = "[email protected]:/home/yizhou7/mariposa/data/projs"
local_filtered_base_path = "/home/amarshah/mariposa_fixed/mariposa/data/projs"

# Ensure the local directories exist
os.makedirs(local_dbg_base_path, exist_ok=True)
os.makedirs(local_proj_base_path, exist_ok=True)

# Loop through all folders in the base directory
for folder_name in os.listdir(base_dir):
# Match folders of the form "singleton_{number}"
if folder_name.startswith("singleton_") and not folder_name.endswith(".filtered"):
number = folder_name[len("singleton_"):]
# First SCP command: Copy dbg files
remote_dbg_path = f"{remote_dbg_base_path}/{number}"
local_dbg_path = f"{local_dbg_base_path}"
dbg_command = ["scp", "-r", remote_dbg_path, local_dbg_path]
print(f"Running: {' '.join(dbg_command)}")
try:
subprocess.run(dbg_command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error while running command: {' '.join(dbg_command)}")
print(e)

# Second SCP command: Copy proj files
remote_proj_path = f"{remote_proj_base_path}/singleton_{number}"
local_proj_path = f"{local_proj_base_path}"
proj_command = ["scp", "-r", remote_proj_path, local_proj_path]
print(f"Running: {' '.join(proj_command)}")
try:
subprocess.run(proj_command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error while running command: {' '.join(proj_command)}")
print(e)

# Third SCP command: Copy filtered proj files
remote_filtered_path = f"{remote_filtered_base_path}/singleton_{number}.filtered"
local_filtered_path = f"{local_filtered_base_path}"
filtered_command = ["scp", "-r", remote_filtered_path, local_filtered_path]
print(f"Running: {' '.join(filtered_command)}")
try:
subprocess.run(filtered_command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error while running command: {' '.join(filtered_command)}")
print(e)
Loading