Skip to content

Commit 3dfd49c

Browse files
committed
should also check access to pawsey
1 parent 8aa24ec commit 3dfd49c

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

possum_pipeline_control/test_database_access.py

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
66
- Checks whether it can access the POSSUM database (only reads)
77
- Checks whether it can access the POSSUM Status Sheet Google Sheet (only reads)
8+
- Checks whether it can access files in pawsey data storage (only reads)
89
9-
Should be executed on p1 and CANFAR.
10+
Should be executed on CANFAR, it will be send there by test_3dpipeline_job.py, so see that module instead
1011
11-
But this script is called by test_3dpipeline_job.py, so see that module instead.
12+
(The module test_3dpipeline_job.py should be executed on p1.)
1213
1314
@author: Erik Osinga
1415
"""
1516

1617
import os
1718
import argparse
19+
import subprocess
1820
from astropy.table import Table
1921
import numpy as np
2022
from dotenv import load_dotenv
@@ -83,6 +85,37 @@ def check_acces_to_google_spread():
8385
return
8486

8587

88+
def check_access_to_pawsey():
89+
"""
90+
Check whether user can see files in the pawsey file storage
91+
92+
This is where the POSSUM data lives that's processed by AUSSRC
93+
"""
94+
95+
rclone_test_cmd = "rclone ls pawsey0980:possum --include tiles/*/11708/*"
96+
97+
try:
98+
result = subprocess.run(
99+
rclone_test_cmd.split(' '),
100+
capture_output=True
101+
)
102+
103+
assert result.returncode == 0, f"Found returncode {result.returncode} for rclone command."
104+
105+
except Exception as e:
106+
print("Failed to access pawsey. Did you configure rclone correctly (on CANFAR)?")
107+
print("Failed with exception:")
108+
print(e)
109+
110+
111+
print("Rclone workings verified. ")
112+
print(f"Ran the command {rclone_test_cmd}")
113+
print("Found the following output:")
114+
print(result.stdout.decode())
115+
116+
return
117+
118+
86119
def parse_args() -> argparse.Namespace:
87120
parser = argparse.ArgumentParser(
88121
description=("Test access to AUSSRC Database and POSSUM Status Sheet")
@@ -109,6 +142,10 @@ def mainflow():
109142
check_acces_to_google_spread_task = task(check_acces_to_google_spread)
110143
check_acces_to_google_spread_task()
111144

145+
# Check access to pawsey
146+
check_access_to_pawsey_task = task(check_access_to_pawsey)
147+
check_access_to_pawsey_task()
148+
112149

113150
if __name__ == "__main__":
114151
args = parse_args()
@@ -123,5 +160,8 @@ def mainflow():
123160
# Check access to Cameron's sheet
124161
check_acces_to_google_spread()
125162

163+
# Check access to pawsey for file download
164+
check_access_to_pawsey()
165+
126166
else:
127167
mainflow()

0 commit comments

Comments
 (0)