@@ -81,6 +81,7 @@ async def worker_synchronize_dataadmins(skip_beamlines=False) -> None:
8181 f"Beamline Data Admin permissions synchronized in { time_taken .total_seconds ():,.2f} seconds"
8282 )
8383
84+
8485async def worker_synchronize_cycles_from_pass (
8586 facility_name : FacilityName = FacilityName .nsls2 ,
8687) -> None :
@@ -148,15 +149,15 @@ async def worker_synchronize_cycles_from_pass(
148149 today = datetime .datetime .now ()
149150 found_cycle = await facility_service .facility_cycle_by_date (facility_name , today )
150151 if not found_cycle :
151- logger .warning (
152- f"No cycle found for today's date in facility { facility_name } "
153- )
152+ logger .warning (f"No cycle found for today's date in facility { facility_name } " )
154153 else :
155154 logger .info (
156155 f"Found cycle { found_cycle .name } for today's date in facility { facility_name } "
157156 )
158157 # Set the current operating cycle for the facility
159- await facility_service .set_current_operating_cycle (facility_name , found_cycle .name )
158+ await facility_service .set_current_operating_cycle (
159+ facility_name , found_cycle .name
160+ )
160161 logger .info (
161162 f"Set current operating cycle for { facility_name } to { found_cycle .name } "
162163 )
@@ -221,6 +222,18 @@ async def worker_synchronize_proposal_types_from_pass(
221222async def synchronize_proposal_from_pass (
222223 proposal_id : str , facility_name : FacilityName = FacilityName .nsls2
223224) -> None :
225+ """
226+ Synchronize a proposal from PASS into the local database.
227+
228+ This function fetches proposal details, associated SAFs, beamlines, and users from PASS,
229+ and updates or inserts the corresponding Proposal document in the database.
230+
231+ :param proposal_id: The PASS proposal ID to synchronize.
232+ :type proposal_id: str
233+ :param facility_name: The facility name (FacilityName) to use for synchronization.
234+ :type facility_name: FacilityName
235+ :return: None
236+ """
224237 beamline_list = []
225238 user_list = []
226239 saf_list = []
@@ -348,10 +361,13 @@ async def update_proposals_with_cycle(
348361 cycle_name : str , facility_name : FacilityName = FacilityName .nsls2
349362) -> None :
350363 """
351- Update the cycle <-> proposals mapping for the given cycle.
364+ Update the mapping between cycles and proposals for the specified cycle.
352365
353366 :param cycle_name: The name of the cycle to process proposals for.
354367 :type cycle_name: str
368+ :param facility_name: The facility name (FacilityName) to use for synchronization.
369+ :type facility_name: FacilityName
370+ :return: None
355371 """
356372
357373 proposal_list = await proposal_service .fetch_proposals_for_cycle (
@@ -364,7 +380,6 @@ async def update_proposals_with_cycle(
364380
365381 for proposal_id in proposal_list :
366382 # Add the cycle to the Proposal object
367-
368383 try :
369384 proposal = await proposal_service .proposal_by_id (proposal_id )
370385 if proposal is not None :
0 commit comments