Skip to content

Commit

Permalink
Added prompt to project copy/creation methods
Browse files Browse the repository at this point in the history
Added prompt to project copy/creation methods
  • Loading branch information
ericdrosas87 committed Jul 3, 2024
1 parent 30ba571 commit 82458bf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 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.5"
version = "0.6.6"
readme = "README.md"
dependencies = [
"panoptes_client",
Expand Down
52 changes: 34 additions & 18 deletions src/rubin/citsci/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,19 @@ def create_new_project_from_template(self, project_id=21302):
Returns an instance of a Zooniverse project.
"""

project_template = Project.find(id=project_id)
self.project = project_template.copy()
self.project.save()
self.project_id = self.project.id
return self.project
if self.project is not None:
print("\n### WARNING - You have already select a project to send data to! Please only proceed if you intend to create a new project and would like to set this new project as the target for sending new data to.\n")
print("\n### WARNING - You are about to create a new project based on a predefined Rubin template project!\n")
response = input("Are you sure you would like to create a new project? (type out 'yes')")
if response.lower() == "yes":
project_template = Project.find(id=project_id)
self.project = project_template.copy()
self.project.save()
self.project_id = self.project.id
return self.project
else:
print("\nNew project creation has been cancelled.")
return

def login_to_zooniverse(self, email):
"""
Expand Down Expand Up @@ -175,19 +183,27 @@ def create_project(self, name, description, make_active_project=False):
if name is None or description is None:
raise CitizenSciencePipelineError("Both the 'project_name' and 'description' arguments are required.")

project = Project()
project.name = name
project.display_name = name
project.description = description
project.primary_language = "en-us"
project.private = False
project.save()

if make_active_project is not None and make_active_project is True:
self.project = project.slug
self.project_id = project.project.id

return project.__dict__
if self.project is not None:
print("\n### WARNING - You have already select a project to send data to! Please only proceed if you intend to create a new project and would like to set this new project as the target for sending new data to.\n")
print("\n### WARNING - You are about to create a new project!\n")
response = input("Are you sure you would like to create a new project? (type out 'yes')")
if response.lower() == "yes":
project = Project()
project.name = name
project.display_name = name
project.description = description
project.primary_language = "en-us"
project.private = False
project.save()

if make_active_project is not None and make_active_project is True:
self.project = project.slug
self.project_id = project.project.id

return project.__dict__
else:
print("\nNew project creation has been cancelled.")
return

def write_manifest_file(self, manifest, batch_dir):
"""
Expand Down

0 comments on commit 82458bf

Please sign in to comment.