Skip to content

Commit

Permalink
removing idiosyncratic poll rename logic, and some other dead code, a…
Browse files Browse the repository at this point in the history
…nd a fixing a typo about identity
  • Loading branch information
petersilva committed Mar 21, 2024
1 parent 20e7914 commit 9b7399d
Showing 1 changed file with 4 additions and 46 deletions.
50 changes: 4 additions & 46 deletions sarracenia/flowcb/poll/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,11 @@ def lsdir(self):
return False, {}, {}

def poll_directory(self, pdir):

#logger.debug("poll_directory %s %s" % (pdir))
npost = 0
msgs = []

# cd to that directory

logger.debug(" cd %s" % pdir)
ok = self.cd(pdir)
if not ok: return []
Expand Down Expand Up @@ -463,12 +462,6 @@ def poll_directory(self, pdir):

def poll_file_post(self, desc, destDir, remote_file):

FileOption = None
for mask in self.pulllst:
pattern, maskDir, maskFileOption, mask_regexp, accepting, mirror, strip, pstrip, flatten = mask
if mask_regexp.match(remote_file) and accepting:
FileOption = maskFileOption

path = destDir + '/' + remote_file

# posting a localfile
Expand Down Expand Up @@ -539,26 +532,11 @@ def poll_file_post(self, desc, destDir, remote_file):

# If there is a file operation, and it isn't a rename, then some fields are irrelevant/wrong.
if 'fileOp' in msg and 'rename' not in msg['fileOp']:
if 'Identity' in msg:
del msg['Indentity']
if 'identity' in msg:
del msg['identity']
if 'size' in msg:
del msg['size']

this_rename = self.o.rename

# FIX ME generalized fileOption
if FileOption is not None:
parts = FileOption.split('=')
option = parts[0].strip()
if option == 'rename' and len(parts) == 2:
this_rename = parts[1].strip()

if this_rename is not None and this_rename[-1] == '/':
this_rename += remote_file

if this_rename is not None:
msg['rename'] = this_rename

return [msg]

def poll_list_post(self, destDir, desclst, filelst):
Expand All @@ -582,20 +560,12 @@ def poll_list_post(self, destDir, desclst, filelst):

def poll(self) -> list:

# General Attributes

self.pulllst = []

msgs = []
# number of post files

npost = 0

# connection did not work

try:
self.dest.connect()
except:
# connection did not work
logger.error("sr_poll/post_new_url: unable to connect to %s" %
self.o.pollUrl)
logger.debug('Exception details: ', exc_info=True)
Expand All @@ -604,20 +574,8 @@ def poll(self) -> list:
time.sleep(nap)
return []

# loop on all directories where there are pulls to do

for destDir in self.o.path:

# setup of poll directory info

#self.pulllst = self.pulls[destDir]

#path = destDir
#path = path.replace('${', '')
#path = path.replace('}', '')
#path = path.replace('/', '_')
#lsPath = self.o.cfg_run_dir + os.sep + 'ls' + path

currentDir = self.o.variableExpansion(destDir)

if currentDir == '': currentDir = destDir
Expand Down

0 comments on commit 9b7399d

Please sign in to comment.