mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-22 12:13:05 +00:00
fix API and CLU calls
This commit is contained in:
parent
f65c2b40f8
commit
1e3ce67834
2 changed files with 10 additions and 9 deletions
|
@ -42,9 +42,7 @@ class ActorSchema(Schema):
|
||||||
|
|
||||||
model: str
|
model: str
|
||||||
statemachine: str
|
statemachine: str
|
||||||
STATE_FIELD_NAME: str
|
ACTIVE_STATE: str
|
||||||
# ACTIVE_STATE: str
|
|
||||||
FINAL_STATES: list[str]
|
|
||||||
EVENT_NAME: str
|
EVENT_NAME: str
|
||||||
CLAIM_ORDER: list[str]
|
CLAIM_ORDER: list[str]
|
||||||
CLAIM_FROM_TOP_N: int
|
CLAIM_FROM_TOP_N: int
|
||||||
|
@ -67,9 +65,9 @@ class ActorSchema(Schema):
|
||||||
def resolve_name(obj) -> str:
|
def resolve_name(obj) -> str:
|
||||||
return str(obj)
|
return str(obj)
|
||||||
|
|
||||||
# @staticmethod
|
@staticmethod
|
||||||
# def resolve_ACTIVE_STATE(obj) -> str:
|
def resolve_ACTIVE_STATE(obj) -> str:
|
||||||
# return str(obj.ACTIVE_STATE)
|
return str(obj.ACTIVE_STATE)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_FINAL_STATES(obj) -> list[str]:
|
def resolve_FINAL_STATES(obj) -> list[str]:
|
||||||
|
|
|
@ -64,8 +64,11 @@ def add(urls: str | list[str],
|
||||||
sources_file.write_text(urls if isinstance(urls, str) else '\n'.join(urls))
|
sources_file.write_text(urls if isinstance(urls, str) else '\n'.join(urls))
|
||||||
|
|
||||||
# 2. create a new Seed pointing to the sources/2024-11-05__23-59-59__cli_add.txt
|
# 2. create a new Seed pointing to the sources/2024-11-05__23-59-59__cli_add.txt
|
||||||
cmd = ' '.join(sys.argv)
|
cli_args = [*sys.argv]
|
||||||
seed = Seed.from_file(sources_file, label=f'{USER}@{HOSTNAME} $ {cmd}', parser=parser, tag=tag, created_by=created_by_id, config={
|
if cli_args[0].lower().endswith('archivebox'):
|
||||||
|
cli_args[0] = 'archivebox' # full path to archivebox bin to just archivebox e.g. /Volumes/NVME/Users/squash/archivebox/.venv/bin/archivebox -> archivebox
|
||||||
|
cmd_str = ' '.join(cli_args)
|
||||||
|
seed = Seed.from_file(sources_file, label=f'{USER}@{HOSTNAME} $ {cmd_str}', parser=parser, tag=tag, created_by=created_by_id, config={
|
||||||
'ONLY_NEW': not update,
|
'ONLY_NEW': not update,
|
||||||
'INDEX_ONLY': index_only,
|
'INDEX_ONLY': index_only,
|
||||||
'OVERWRITE': overwrite,
|
'OVERWRITE': overwrite,
|
||||||
|
@ -80,7 +83,7 @@ def add(urls: str | list[str],
|
||||||
# from crawls.actors import CrawlActor
|
# from crawls.actors import CrawlActor
|
||||||
# from core.actors import SnapshotActor, ArchiveResultActor
|
# from core.actors import SnapshotActor, ArchiveResultActor
|
||||||
|
|
||||||
orchestrator = Orchestrator(exit_on_idle=True)
|
orchestrator = Orchestrator(exit_on_idle=True, max_concurrent_actors=2)
|
||||||
orchestrator.start()
|
orchestrator.start()
|
||||||
|
|
||||||
# 5. return the list of new Snapshots created
|
# 5. return the list of new Snapshots created
|
||||||
|
|
Loading…
Reference in a new issue