Skip to content

Commit 2dfb648

Browse files
committed
Rather drastic deletion of space checking since current system does not support df utility
1 parent 5b2b0d8 commit 2dfb648

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

taca/backup/backup.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -102,61 +102,6 @@ def collect_runs(self, ext=None, filter_by_ext=False):
102102
if self._is_ready_to_archive(run, ext):
103103
self.runs.append(run)
104104

105-
def avail_disk_space(self, path, run):
106-
"""Check the space on file system based on parent directory of the run."""
107-
# not able to fetch runtype use the max size as precaution, size units in GB
108-
run_sizes = {
109-
"novaseq": 1800,
110-
"miseq": 20,
111-
"nextseq": 250,
112-
"NovaSeqXPlus": 3600,
113-
"promethion": 3000,
114-
"minion": 1000,
115-
"aviti": 350,
116-
}
117-
required_size = run_sizes.get(self._get_run_type(run), 900) * 2
118-
# check for any ongoing runs and add up the required size accordingly
119-
for data_dir in self.data_dirs.values():
120-
if not os.path.isdir(data_dir):
121-
continue
122-
for run_dir in os.listdir(data_dir):
123-
if not (
124-
re.match(filesystem.RUN_RE_ILLUMINA, run_dir)
125-
or re.match(filesystem.RUN_RE_ONT, run_dir)
126-
or re.match(filesystem.RUN_RE_ELEMENT, run_dir)
127-
):
128-
continue
129-
if not (
130-
os.path.exists(
131-
os.path.join(data_dir, run_dir, "RTAComplete.txt")
132-
) # Illumina
133-
or os.path.exists(
134-
os.path.join(data_dir, run_dir, ".sync_finished") # ONT
135-
)
136-
or os.path.exists(
137-
os.path.join(data_dir, run_dir, "RunUploaded.json") # Element
138-
)
139-
):
140-
required_size += run_sizes.get(self._get_run_type(run), 900)
141-
# get available free space from the file system
142-
try:
143-
df_proc = sp.Popen(["df", path], stdout=sp.PIPE, stderr=sp.PIPE)
144-
df_out, df_err = df_proc.communicate()
145-
available_size = (
146-
int(df_out.strip().decode("utf-8").split("\n")[-1].strip().split()[3])
147-
/ 1024
148-
/ 1024
149-
)
150-
except Exception as e:
151-
logger.error(f"Evaluation of disk space failed with error {e}")
152-
raise SystemExit
153-
if available_size < required_size:
154-
e_msg = f"Required space for encryption is {required_size}GB, but only {available_size}GB available"
155-
subjt = f"Low space for encryption - {self.host_name}"
156-
logger.error(e_msg)
157-
misc.send_mail(subjt, e_msg, self.mail_recipients)
158-
raise SystemExit
159-
160105
def file_in_pdc(self, src_file, silent=True):
161106
"""Check if the given files exist in PDC."""
162107
# dsmc will return zero/True only when file exists, it returns
@@ -381,8 +326,6 @@ def encrypt_runs(cls, run, force):
381326
run.dst_key_encrypted = os.path.join(bk.keys_path, run.key_encrypted)
382327
tmp_files = [run.tar_encrypted, run.key_encrypted, run.key, run.flag]
383328
logger.info(f"Encryption of run {run.name} is now started")
384-
# Check if there is enough space and exit if not
385-
bk.avail_disk_space(run.path, run.name)
386329
# Check if the run in demultiplexed
387330
if not force and bk.check_demux:
388331
if not misc.run_is_demuxed(

0 commit comments

Comments
 (0)