Skip to content

Commit

Permalink
Added list_workflows() function
Browse files Browse the repository at this point in the history
Added `list_workflows()` function
  • Loading branch information
ericdrosas87 committed Sep 13, 2024
1 parent 500dc6e commit 751ceb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
]
description = "The companion package to the Rubin citizen science notebooks."

version = "0.6.6"
version = "0.7.0"
readme = "README.md"
dependencies = [
"panoptes_client",
Expand Down
24 changes: 23 additions & 1 deletion src/rubin/citsci/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from importlib.metadata import version
import google.cloud.storage as storage
import panoptes_client
from panoptes_client import Project, SubjectSet, Classification
from panoptes_client import Project, SubjectSet, Classification, Workflow

class CitSciPipeline:
"""
Expand Down Expand Up @@ -115,6 +115,28 @@ def login_to_zooniverse(self, email):
print("Invalid email address! Please check the email address you provided and ensure it is correct.")
return

def list_workflows(self):
"""
If the user has logged into the Zooniverse platform via the login_to_zooniverse()
function and selected a project, then this cell will list all active workflows for
the selected project.
"""

if self.project is None:
print("Please log in first using login_to_zooniverse() first before attempting to retrieve workflows.")
return

active_workflows = self.project.raw["links"]["active_workflows"]
if len(active_workflows) > 0:
print("\n*==* Your Workflows *==*\n")
for workflow in active_workflows:
display_name = Workflow.find(workflow).raw["display_name"]
print(f"Workflow ID: {workflow} - Display Name: {display_name}")
print("\n*==========================*\n")
else:
print("There are no active workflows for the project you have selected.")
return

def __log_slug_names(self):
projects = self.client.get(f"/projects?owner={self.client.username}")
slugnames = []
Expand Down

0 comments on commit 751ceb3

Please sign in to comment.