Skip to content

Commit

Permalink
Remove some more debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Oct 27, 2023
1 parent ad10f1b commit 8abc404
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 69 deletions.
1 change: 0 additions & 1 deletion synapseclient/core/upload/multipart_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ def _upload_parts(self, part_count, remaining_part_numbers):

if isinstance(cause, KeyboardInterrupt):
raise SynapseUploadAbortedException("User interrupted upload")
self._syn.logger.exception(cause)
raise SynapseUploadFailedException("Part upload failed") from cause

def _complete_upload(self):
Expand Down
81 changes: 13 additions & 68 deletions tests/integration/synapseclient/core/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ def test_threaded_access(syn: Synapse, project: Project, schedule_for_cleanup):

syn.test_keepRunning = False
while syn.test_threadsRunning > 0:
syn.logger.warning(
f"Waiting on test_threaded_access() to finish ({syn.test_threadsRunning} threads remaining)"
)
time.sleep(1)

# Reset the requests logging level
Expand All @@ -101,20 +98,12 @@ def child_thread():
syn.test_runCountMutex.acquire()
syn.test_threadsRunning += 1
syn.test_runCountMutex.release()
unique_uuid = str(uuid.uuid4())

try:
syn.logger.warning(
f"Starting thread uuid: {unique_uuid}, function: {str(function)}"
)
function(*args, **kwargs, unique_uuid=unique_uuid)
function(*args, **kwargs)
except Exception as ex:
syn.logger.warning(
f"Exception in thread uuid: {unique_uuid}, exception: {ex}"
)
syn.test_errors.put(traceback.format_exc())

syn.logger.warning(f"Finished thread uuid: {unique_uuid}")
syn.test_runCountMutex.acquire()
syn.test_threadsRunning -= 1
syn.test_runCountMutex.release()
Expand All @@ -136,9 +125,7 @@ def collect_errors_and_fail(syn: Synapse):
######################


def thread_keep_storing_one_File(
syn: Synapse, project: Project, schedule_for_cleanup, unique_uuid: str
):
def thread_keep_storing_one_File(syn: Synapse, project: Project, schedule_for_cleanup):
"""Makes one file and stores it over and over again."""

# Make a local file to continuously store
Expand All @@ -149,15 +136,12 @@ def thread_keep_storing_one_File(
)

while syn.test_keepRunning:
syn.logger.warning(
f"thread_keep_storing_one_File(): [storing {myPrecious.path}, uuid: {unique_uuid}]"
)
stored = None
try:
stored = store_catch_412_HTTPError(syn, myPrecious)
except FunctionTimedOut:
syn.logger.warning(
f"thread_keep_storing_one_File()::store_catch_412_HTTPError timed out, Path: {myPrecious.path}, uuid: {unique_uuid}"
f"thread_keep_storing_one_File()::store_catch_412_HTTPError timed out, [Path: {myPrecious.path}]"
)

if stored is not None:
Expand All @@ -167,68 +151,38 @@ def thread_keep_storing_one_File(
# and thus has a retrievable synapse id
myPrecious = syn.get(myPrecious)

syn.logger.warning(
f"Starting sleep - thread_keep_storing_one_File(), uuid: {unique_uuid}"
)
time_slept = sleep_for_a_bit()
syn.logger.warning(
f"Slept {time_slept}s - thread_keep_storing_one_File(), uuid: {unique_uuid}"
)
sleep_for_a_bit()


def thread_get_files_from_Project(syn: Synapse, project: Project, unique_uuid: str):
def thread_get_files_from_Project(syn: Synapse, project: Project):
"""Continually polls and fetches items from the Project."""

while syn.test_keepRunning:
syn.logger.warning(
f"thread_get_files_from_Project(), Project: {project.id}, uuid: {unique_uuid}"
)
ids = []
try:
ids = get_all_ids_from_Project(syn, project)
get_all_ids_from_Project(syn, project)
except FunctionTimedOut:
syn.logger.warning(
f"thread_get_files_from_Project()::get_all_ids_from_Project timed out, [Project: {project.id}, uuid: {unique_uuid}]"
f"thread_get_files_from_Project()::get_all_ids_from_Project timed out, [Project: {project.id}]"
)
for id in ids:
syn.logger.warning(
f"thread_get_files_from_Project(), retrieved id: [Project: {project.id}, id: {id}, uuid: {unique_uuid}]"
)
pass

syn.logger.warning(
f"Starting sleep thread_get_files_from_Project(), uuid: {unique_uuid}"
)
time_slept = sleep_for_a_bit()
syn.logger.warning(
f"Slept {time_slept} thread_get_files_from_Project(), uuid: {unique_uuid}"
)
sleep_for_a_bit()


def thread_get_and_update_file_from_Project(
syn: Synapse, project: Project, schedule_for_cleanup, unique_uuid: str
syn: Synapse, project: Project, schedule_for_cleanup
):
"""Fetches one item from the Project and updates it with a new file."""

while syn.test_keepRunning:
syn.logger.warning(
f"Running thread_get_and_update_file_from_Project(), uuid: {unique_uuid}"
)
id = []
try:
id = get_all_ids_from_Project(syn, project)
except FunctionTimedOut:
syn.logger.warning(
f"thread_get_and_update_file_from_Project()::get_all_ids_from_Project timed out, [project: {project.id}, uuid: {unique_uuid}]"
f"thread_get_and_update_file_from_Project()::get_all_ids_from_Project timed out, [project: {project.id}]"
)
if len(id) <= 0:
syn.logger.warning(
f"Starting sleep thread_get_and_update_file_from_Project() - Length {len(id)}, uuid: {unique_uuid}"
)
time_slept = sleep_for_a_bit()
syn.logger.warning(
f"Slept {time_slept} thread_get_and_update_file_from_Project() - Length {len(id)}, uuid: {unique_uuid}"
)
sleep_for_a_bit()
continue

id = id[random.randrange(len(id))]
Expand All @@ -237,26 +191,17 @@ def thread_get_and_update_file_from_Project(
# Replace the file and re-store
path = utils.make_bogus_data_file()
schedule_for_cleanup(path)
syn.logger.warning(
f"thread_get_and_update_file_from_Project(), Updating: [project: {project.id}, entity: {entity.id}, path: {path}, uuid: {unique_uuid}]"
)
entity.path = path
try:
entity = store_catch_412_HTTPError(syn, entity)
except FunctionTimedOut:
syn.logger.warning(
f"thread_get_and_update_file_from_Project()::store_catch_412_HTTPError timed out, path: {entity.path}, uuid: {unique_uuid}"
f"thread_get_and_update_file_from_Project()::store_catch_412_HTTPError timed out, [project: {project.id}, path: {entity.path}]"
)
if entity is not None:
assert os.stat(entity.path) == os.stat(path)

syn.logger.warning(
f"Starting sleep thread_get_and_update_file_from_Project(), uuid: {unique_uuid}"
)
time_slept = sleep_for_a_bit()
syn.logger.warning(
f"Slept {time_slept} thread_get_and_update_file_from_Project(), uuid: {unique_uuid}"
)
sleep_for_a_bit()


####################
Expand Down

0 comments on commit 8abc404

Please sign in to comment.