Skip to content

Commit

Permalink
updated pfstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Jul 20, 2023
1 parent 2630a5d commit cba7874
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
12 changes: 10 additions & 2 deletions bin/pfstorage
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import sys, os, pudb, socket, json
sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..'))

from pypx import PfStorage, swiftStorage, swiftStore
from pypx import swiftStore
from argparse import RawTextHelpFormatter
from argparse import ArgumentParser
from pfmisc._colors import Colors


str_name = "pfstorage"
str_version = "3.2.6"
str_version = "3.2.7"
str_desc = Colors.CYAN + """
__ _
Expand Down Expand Up @@ -211,6 +211,14 @@ def synopsis(ab_shortOnly = False):

parser = ArgumentParser(description = str_desc, formatter_class = RawTextHelpFormatter)

parser.add_argument(
'--storeBaseLocation',
action = 'store',
dest = 'str_storeBaseLocation',
type = str,
default = '',
help = 'Base location where a File system is mounted')

parser.add_argument(
'--swiftIP',
action = 'store',
Expand Down
7 changes: 5 additions & 2 deletions pypx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .do import Do
from .push import Push
from .register import Register
from .pfstorage import PfStorage, swiftStorage
from .pfstorage import swiftStorage, fileStorage

def echo(opt={}):
return Echo(opt).run()
Expand Down Expand Up @@ -37,4 +37,7 @@ def register(opt={}):
return Register(opt).run(opt)

def swiftStore(opt={}):
return swiftStorage(opt).run(opt)
if opt.get("str_storeBaseLocation"):
return fileStorage(opt).run(opt)
else :
return swiftStorage(opt).run(opt)
3 changes: 2 additions & 1 deletion pypx/pfstorage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3.5

import abc
import glob

import sys
from io import BytesIO as IO
Expand Down Expand Up @@ -1019,7 +1020,7 @@ def connect(self, *args, **kwargs):
def ls(self, *args, **kwargs):
pass

def ls_process(self, *args, **kwargs):
def ls_process(self, *args, **kwargs) -> dict:
pass

def objExists(self, *args, **kwargs):
Expand Down
11 changes: 7 additions & 4 deletions workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export PYPX=local/pypx

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

# storage type
export STORAGETYPE=swift
#
# swift storage environment
#
Expand Down Expand Up @@ -170,10 +172,11 @@ docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT -v $LOCALDICOMDIR:$LOCALDICOMDIR \
# Set the swift login info in a key-ref'd service
px-smdb \
--logdir $DB \
--action swift \
--action storage \
--actionArgs '
{
"'$SWIFTKEY'": {
"storagetype": "'$STORAGETYPE'",
"ip": "'$SWIFTHOST'",
"port":"'$SWIFTPORT'",
"login":"'$SWIFTLOGIN'"
Expand All @@ -185,9 +188,9 @@ px-smdb \
docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT $PYPX \
--px-smdb \
--logdir $DB \
--action swift \
--action storage \
--actionArgs \
'{\"'$SWIFTKEY'\":{\"ip\":\"'$SWIFTHOST'\",\"port\":\"'$SWIFTPORT'\",\"login\":\"'$SWIFTLOGIN'\"}}'
'{\"'$SWIFTKEY'\":{\"storagetype\":\"'$STORAGETYPE'\",\"ip\":\"'$SWIFTHOST'\",\"port\":\"'$SWIFTPORT'\",\"login\":\"'$SWIFTLOGIN'\"}}'

# Get the swift login details for all keys
# This examines the service file, swift.json, located in
Expand All @@ -199,7 +202,7 @@ px-smdb \
docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT $PYPX \
--px-smdb \
--logdir $DB \
--action swift
--action storage

# Query smdb for all image dirs on a patient
px-smdb \
Expand Down

0 comments on commit cba7874

Please sign in to comment.