Skip to content

Commit

Permalink
rename swift with storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Jul 17, 2023
1 parent 41a083b commit 8add161
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions pypx/pfstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def __init__(self, arg, *args, **kwargs):
"""

proto = 'https' if arg['str_swiftPort'] == '443' else 'http'
if arg['str_swiftBaseLocation']:
cont_name = arg['str_swiftBaseLocation']
if arg['str_storeBaseLocation']:
cont_name = arg['str_storeBaseLocation']
else:
cont_name = "users"
self.state_create(
Expand Down Expand Up @@ -1062,4 +1062,4 @@ def run(self, opt={}) -> dict:
self.log(str_msg, comms = 'error')
self.log(json.dumps(d_actionResult, indent = 4), comms = 'tx')

return d_actionResult
return d_actionResult
20 changes: 10 additions & 10 deletions pypx/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def parser_setup(str_desc):
action = 'store_true',
default = False)
parser.add_argument(
'--swiftBaseLocation',
'--storeBaseLocation',
action = 'store',
dest = 'str_swiftBaseLocation',
dest = 'str_storeBaseLocation',
type = str,
default = '',
help = 'swift base location to push files')
Expand Down Expand Up @@ -244,15 +244,15 @@ def serviceKey_process(self) -> dict:
d_swiftInfo : dict = {}
d_swiftInfo['status'] = False
if len(self.arg['swift']):
d_swiftInfo = self.smdb.service_keyAccess('swift')
d_swiftInfo = self.smdb.service_keyAccess('storage')
if d_swiftInfo['status']:
storageType = d_swiftInfo['swift'][self.arg['swift']]['storagetype']
storageType = d_swiftInfo['storage'][self.arg['swift']]['storagetype']
if storageType == "swift":
self.arg['str_swiftIP'] = d_swiftInfo['swift'][self.arg['swift']]['ip']
self.arg['str_swiftPort'] = d_swiftInfo['swift'][self.arg['swift']]['port']
self.arg['str_swiftLogin'] = d_swiftInfo['swift'][self.arg['swift']]['login']
self.arg['str_swiftIP'] = d_swiftInfo['storage'][self.arg['swift']]['ip']
self.arg['str_swiftPort'] = d_swiftInfo['storage'][self.arg['swift']]['port']
self.arg['str_swiftLogin'] = d_swiftInfo['storage'][self.arg['swift']]['login']
elif storageType == "fs":
self.arg['str_swiftBaseLocation'] = d_swiftInfo['swift'][self.arg['swift']]['storepath']
self.arg['str_storeBaseLocation'] = d_swiftInfo['storage'][self.arg['swift']]['storepath']
return d_swiftInfo

def __init__(self, arg):
Expand Down Expand Up @@ -332,7 +332,7 @@ def path_pushToSwift(self):
'mapLocationOver' : self.arg['str_xcrdir']
}
}
if self.arg['str_swiftBaseLocation']:
if self.arg['str_storeBaseLocation']:
store = fileStorage(self.arg)
else:
store = swiftStorage(self.arg)
Expand All @@ -349,7 +349,7 @@ def path_pushToSwift(self):
self.smdb.seriesData('push', 'timestamp', now.strftime("%Y-%m-%d, %H:%M:%S"))
if len(self.arg['swift']):
self.smdb.seriesData('push', 'swift',
self.smdb.service_keyAccess('swift')['swift'][self.arg['swift']])
self.smdb.service_keyAccess('storage')['storage'][self.arg['swift']])
return d_storeDo

def run(self, opt={}) -> dict:
Expand Down
8 changes: 4 additions & 4 deletions pypx/smdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def __init__(self, args):
'../'
)
self.str_services : str = "services"
self.str_swiftService : str = "swift.json"
self.str_swiftService : str = "storage.json"
self.str_CUBEservice : str = "cube.json"
self.str_PACSservice : str = "pacs.json"
self.str_TELEservice : str = "telemetry.json"
Expand Down Expand Up @@ -1669,7 +1669,7 @@ def service_keyAccess(self, astr_service) -> dict:
d_update : dict = {}
d_ret['status'] = False

if astr_service.lower().strip() == 'swift':
if astr_service.lower().strip() == 'storage':
str_service : str = os.path.join(
self.str_servicesDir,
self.str_swiftService
Expand Down Expand Up @@ -1800,8 +1800,8 @@ def DBtablesGet_do() -> dict:
d_run = seriesDirLocation_doget()
if 'DBtablesGet' in self.args.str_action:
d_run = DBtablesGet_do()
if 'swift' in self.args.str_action:
d_run = self.service_keyAccess('swift')
if 'storage' in self.args.str_action:
d_run = self.service_keyAccess('storage')
if 'CUBE' in self.args.str_action:
d_run = self.service_keyAccess('CUBE')
if 'PACS' in self.args.str_action:
Expand Down
18 changes: 9 additions & 9 deletions workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PURPOSE="

# Which pypx do you want to use? :)
# export PYPX=fnndsc/pypx
export PYPX=fnndsc/pypx
export PYPX=local/pypx

#
# Manually run a storescp:
Expand All @@ -52,19 +52,19 @@ export PYPX=fnndsc/pypx
#
# MOST LIKELY YOU WILL NOT NEED TO DO THIS
#
storescp -od /tmp/data \
-pm -sp \
-xcr "/home/rudolphpienaar/src/pypx/bin/px-repack --xcrdir #p --xcrfile #f --verbosity 0 --logdir /home/dicom/log --datadir /home/dicom/data" \
-xcs "/home/rudolphpienaar/src/pypx/bin/px-smdb --xcrdir #p --action endOfStudy" \
11113
#storescp -od /tmp/data \
# -pm -sp \
# -xcr "/home/rudolphpienaar/src/pypx/bin/px-repack --xcrdir #p --xcrfile #f --verbosity 0 --logdir /home/dicom/log --datadir /home/dicom/data" \
# -xcs "/home/rudolphpienaar/src/pypx/bin/px-smdb --xcrdir #p --action endOfStudy" \
# 11113

# Edit any/all of the following as appropriate to your local env.

#
# swift storage environment
#
export SWIFTKEY=local
export SWIFTHOST=10.0.0.230
export SWIFTHOST=192.168.0.9
export SWIFTPORT=8080
export SWIFTLOGIN=chris:chris1234
export SWIFTSERVICEPACS=orthanc
Expand All @@ -73,7 +73,7 @@ export SWIFTSERVICEPACS=orthanc
# CUBE login details
#
export CUBEKEY=local
export CUBEURL=http://localhost:8000/api/v1/
export CUBEURL=http://192.168.0.9:8000/api/v1/
export CUBEusername=chris
export CUBEuserpasswd=chris1234

Expand All @@ -91,7 +91,7 @@ export DB=/neuro/users/chris/PACS/log
#
export AEC=ORTHANC
export AET=CHRISLOCAL
export PACSIP=192.168.1.200
export PACSIP=192.168.0.9
export PACSPORT=4242

#
Expand Down

0 comments on commit 8add161

Please sign in to comment.