Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'process' method to 'launch' across core and realms #8

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/base/abstract_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,14 @@ def __init__(self, doc: Any, yggdrasil_db_manager: Any) -> None:
self.yggdrasil_db_manager: Any = yggdrasil_db_manager

@abstractmethod
def pre_process(self) -> None:
"""Handle preliminary processing specific to the realm's requirements."""
pass

@abstractmethod
async def process(self) -> None:
async def launch(self) -> None:
"""Define the main processing logic for the project.

This method should be implemented by each project class to define how the processing
of the document unfolds.

Note:
Since processing might involve asynchronous operations (e.g., submitting and monitoring jobs),
Since its course might involve asynchronous operations (e.g., submitting and monitoring jobs),
this method is defined as asynchronous.
"""
pass
Expand Down
15 changes: 2 additions & 13 deletions lib/realms/smartseq3/smartseq3.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,8 @@ def ensure_project_directory(self):
logging.error(f"Failed to create project directory: {e}")
return None

async def process(self):
"""
Process the SmartSeq3 project by handling its samples.
"""
async def launch(self):
"""Launch the SmartSeq3 Realm to handle its samples."""
self.status = "processing"
logging.info(
f"Processing SmartSeq3 project {self.project_info['project_name']}"
Expand Down Expand Up @@ -212,15 +210,6 @@ def _generate_ngi_report(self):
else:
logging.error("Failed to generate the NGI report.")

def pre_process(self, doc):
"""
Pre-process method placeholder.

Args:
doc (dict): Document to pre-process.
"""
pass

def create_slurm_job(self, sample):
"""
Placeholder for creating a Slurm job on the project level.
Expand Down
8 changes: 2 additions & 6 deletions lib/realms/tenx/tenx_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,8 @@ def extract_samples(self) -> List[TenXRunSample]:
run_samples = self.create_run_samples(grouped_lab_samples)
return run_samples

def pre_process(self) -> None:
"""Perform any pre-processing steps required before processing the project."""
pass

async def process(self):
"""Process the TenX project by handling its samples."""
async def launch(self):
"""Launch the TenX Realm to handle its samples."""
logging.info(f"Processing TenX project {self.project_info['project_name']}")
self.status = "processing"

Expand Down
2 changes: 1 addition & 1 deletion ygg-mule.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def process_document(doc_id):
if RealmClass:
realm = RealmClass(document, ydm)
if realm.proceed:
asyncio.run(realm.process())
asyncio.run(realm.launch())
logging.info("Processing complete.")
else:
logging.info(
Expand Down
5 changes: 2 additions & 3 deletions ygg_trunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ async def process_couchdb_changes():
RealmClass = Ygg.load_realm_class(module_loc)

if RealmClass:
# Call the module's process function
# Call the module's launch function
realm = RealmClass(data, ydm)
if realm.proceed:
task = asyncio.create_task(realm.process())
task = asyncio.create_task(realm.launch())
tasks.append(task)
# print(f"Tasks ({realm.project_info['project_id']}): {tasks}")
# module.process(data)
else:
logging.info(
f"Skipping task creation due to missing required information. {data.get('project_id')}"
Expand Down
Loading