Skip to content

Commit

Permalink
Merge pull request #16 from lsst-epo/EPO-8517
Browse files Browse the repository at this point in the history
Removed noisy warning, check for completnenss
  • Loading branch information
ericdrosas87 authored Oct 5, 2023
2 parents 619117c + c553c03 commit 750e937
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rubin.citsci"
version = "0.1.4"
version = "0.2.0"
readme = "README.md"
dependencies = [
"panoptes_client",
Expand Down
16 changes: 9 additions & 7 deletions src/rubin/citsci/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self):
self.email = ""
self.project = None
self.client = None
if os.getenv("CITSCI_PIPELINE_DEV_MODE") is not None:
if os.getenv("CITSCI_PIPELINE_DEV_MODE") is "1" or os.getenv("CITSCI_PIPELINE_DEV_MODE").lower() is "true" :
self.dev_mode_url = "-dev"
print("Development mode enabled.")
else:
Expand Down Expand Up @@ -72,7 +72,8 @@ def clean_up_unused_subject_set(self):
subject_set.delete()

except:
display(f"** Warning: Failed to find the subject set with id: {str(self.vendor_batch_id)}- perhaps it's been deleted?.")
pass
# display(f"** Warning: Failed to find the subject set with id: {str(self.vendor_batch_id)}- perhaps it's been deleted?.")
return

def send_zooniverse_manifest(self):
Expand Down Expand Up @@ -115,7 +116,7 @@ def send_tabular_data(self, subject_set_name, manifest_location):
self.log_step("Checking batch status")
if self.has_active_batch() == True:
self.log_step("Active batch exists!!! Continuing because this notebook is in debug mode")
raise CitizenScienceError("You cannot send another batch of data while a subject set is still active on the Zooniverse platform - you can only send a new batch of data if all subject sets associated to a project have been completed.")
raise CitizenSciencePipelineError("You cannot send another batch of data while a subject set is still active on the Zooniverse platform - you can only send a new batch of data if all subject sets associated to a project have been completed.")

self.log_step("Creating new subject set")
self.create_new_subject_set(subject_set_name)
Expand Down Expand Up @@ -144,7 +145,7 @@ def send_image_data(self, subject_set_name, batch_dir, cutout_data = None):
self.step = 0
self.log_step("Checking batch status")
if self.has_active_batch() == True:
raise CitizenScienceError("You cannot send another batch of data while a subject set is still active on the Zooniverse platform - you can only send a new batch of data if all subject sets associated to a project have been completed.")
raise CitizenSciencePipelineError("INCOMPLETE SUBJECT SET EXISTS! You cannot send another batch of data while a subject set is still active (not yet retired) on the Zooniverse platform - you can only send a new batch of data if all subject sets associated to a project have been completed.")
zip_path = self.zip_image_cutouts(batch_dir)
self.upload_cutouts(zip_path)
self.create_new_subject_set(subject_set_name)
Expand Down Expand Up @@ -253,13 +254,14 @@ def has_active_batch(self):
for subject_set in self.project.links.subject_sets:
try:
for completeness_percent in list(subject_set.completeness.values()):
if completeness_percent == 1.0:
if completeness_percent < 1.0:
active_batch = True
break
if active_batch:
break
except:
display(" ** Warning! - The Zooniverse client is throwing an error about a missing subject set, this can likely safely be ignored.");
pass
# display(" ** Warning! - The Zooniverse client is throwing an error about a missing subject set, this can likely safely be ignored.");
return active_batch

def log_step(self, msg):
Expand All @@ -268,7 +270,7 @@ def log_step(self, msg):
return

# Custom error handling for this notebook
class CitizenScienceError(Exception):
class CitizenSciencePipelineError(Exception):

# Constructor or Initializer
def __init__(self, value):
Expand Down

0 comments on commit 750e937

Please sign in to comment.