mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-22 12:13:05 +00:00
23 lines
695 B
Python
23 lines
695 B
Python
__package__ = 'archivebox.crawls'
|
|
|
|
from typing import ClassVar
|
|
|
|
from crawls.models import Crawl
|
|
from crawls.statemachines import CrawlMachine
|
|
|
|
from actors.actor import ActorType, State
|
|
|
|
|
|
class CrawlActor(ActorType[Crawl]):
|
|
"""The Actor that manages the lifecycle of all Crawl objects"""
|
|
|
|
Model = Crawl
|
|
StateMachineClass = CrawlMachine
|
|
|
|
ACTIVE_STATE: ClassVar[State] = CrawlMachine.started
|
|
FINAL_STATES: ClassVar[list[State]] = CrawlMachine.final_states
|
|
STATE_FIELD_NAME: ClassVar[str] = Crawl.state_field_name
|
|
|
|
MAX_CONCURRENT_ACTORS: ClassVar[int] = 3
|
|
MAX_TICK_TIME: ClassVar[int] = 10
|
|
CLAIM_FROM_TOP_N: ClassVar[int] = MAX_CONCURRENT_ACTORS * 10
|