Skip to content

Commit

Permalink
Debug spawn type
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett committed Jan 5, 2023
1 parent 3e4eca3 commit 83716c9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/transactors/file_transactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class FileTransactor(object):
queue = None

def __init__(self):
multiprocessing.set_start_method('fork')
logger.info("Spawn Type: " + multiprocessing.get_start_method())
#multiprocessing.set_start_method('fork')
#multiprocessing.set_start_method("spawn")
m = multiprocessing.Manager()
FileTransactor.queue = m.Queue()
self.filetracking_queue = m.list()
Expand Down Expand Up @@ -53,9 +55,9 @@ def run(self, filetracking_queue):
try:
(sub_type, FileTransactor.count) = FileTransactor.queue.get()
except EOFError as error:
logger.debug("Queue Closed exiting: %s" % error)
logger.info("Queue Closed exiting: %s" % error)
return
logger.debug("%s: Pulled File Transaction Batch: %s QueueSize: %s " % (self._get_name(), FileTransactor.count, FileTransactor.queue.qsize()))
logger.info("%s: Pulled File Transaction Batch: %s QueueSize: %s " % (self._get_name(), FileTransactor.count, FileTransactor.queue.qsize()))
self.download_file(sub_type, filetracking_queue)
FileTransactor.queue.task_done()
#EOFError
Expand All @@ -64,19 +66,19 @@ def download_file(self, sub_type, filetracking_queue):
filepath = sub_type.get_filepath()
filepath_to_download = sub_type.get_file_to_download()

logger.debug("%s: Acquiring file: %s from filepath: %s" % (self._get_name(), filepath, filepath_to_download))
logger.info("%s: Acquiring file: %s from filepath: %s" % (self._get_name(), filepath, filepath_to_download))

logger.debug("%s: Checking whether the file is currently downloading: %s" % (self._get_name(), filepath_to_download))
logger.info("%s: Checking whether the file is currently downloading: %s" % (self._get_name(), filepath_to_download))

if filepath_to_download in filetracking_queue:
logger.debug("%s: The file is already downloading, waiting for it to finish: %s" % (self._get_name(), filepath_to_download))
logger.info("%s: The file is already downloading, waiting for it to finish: %s" % (self._get_name(), filepath_to_download))
while filepath_to_download in filetracking_queue:
sleep(1)
logger.debug("%s: File no longer downloading, proceeding: %s" % (self._get_name(), filepath_to_download))
logger.info("%s: File no longer downloading, proceeding: %s" % (self._get_name(), filepath_to_download))
sub_type.get_data()
else:
logger.debug("%s: File not currently downloading, initiating download: %s" % (self._get_name(), filepath_to_download))
logger.info("%s: File not currently downloading, initiating download: %s" % (self._get_name(), filepath_to_download))
filetracking_queue.append(filepath_to_download)
sub_type.get_data()
logger.debug("%s: Download complete. Removing item from download queue: %s" % (self._get_name(), filepath_to_download))
logger.info("%s: Download complete. Removing item from download queue: %s" % (self._get_name(), filepath_to_download))
filetracking_queue.remove(filepath_to_download)

0 comments on commit 83716c9

Please sign in to comment.