swh.lister.grokmirror.lister module#
- class swh.lister.grokmirror.lister.GrokmirrorListerState(last_listing_date: datetime | None = None)[source]#
Bases:
objectState of Grokmirror lister
- class swh.lister.grokmirror.lister.GrokmirrorLister(scheduler: SchedulerInterface, url: str | None = None, instance: str | None = None, credentials: Dict[str, Dict[str, List[Dict[str, str]]]] | None = None, max_origins_per_page: int | None = None, max_pages: int | None = None, enable_origins: bool = True, **kwargs)[source]#
Bases:
Lister[GrokmirrorListerState,Dict[str,Any]]Lister class for Grokmirror instances.
This lister will retrieve the list of published git repositories by retrieving the JSON manifest files published on the server, checking the modification dates, decompressing and parsing one.
The lister checks the URLs /manifest.js.gz /manifest.js /manifest
https://git.kernel.org/pub/scm/utils/grokmirror/grokmirror.git/about/
Lister class for Grokmirror repositories.
- state_from_dict(d: Dict[str, Any]) GrokmirrorListerState[source]#
Convert the state stored in the scheduler backend (as a dict), to the concrete StateType for this lister.
- state_to_dict(state: GrokmirrorListerState) Dict[str, Any][source]#
Convert the StateType for this lister to its serialization as dict for storage in the scheduler.
Values must be JSON-compatible as that’s what the backend database expects.
- get_pages() Iterator[Dict[str, Any]][source]#
Retrieve a list of pages of listed results. This is the main loop of the lister.
- Returns:
an iterator of raw pages fetched from the platform currently being listed.
- get_origins_from_page(repositories: Dict[str, Any]) Iterator[ListedOrigin][source]#
Convert Grokmirror repositories into a list of ListedOrigins.
- finalize() None[source]#
Custom hook to finalize the lister state before returning from the main loop.
This method must set
updatedif the lister has done some work.If relevant, this method can use :meth`get_state_from_scheduler` to merge the current lister state with the one from the scheduler backend, reducing the risk of race conditions if we’re running concurrent listings.
This method is called in a finally block, which means it will also run when the lister fails.