Skip to content

Commit

Permalink
Rename 'process' method to 'launch' across core and realms
Browse files Browse the repository at this point in the history
  • Loading branch information
glrs committed Oct 29, 2024
1 parent 7a7ff2d commit 2539f9b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 30 deletions.
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

0 comments on commit 2539f9b

Please sign in to comment.