Skip to content

Commit

Permalink
update Makefile, compose.sample.yml and __main__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Jun 21, 2024
1 parent 16a5a7c commit 1f68769
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ docker_ci: ## Run all checks in docker

docker-smoketest:
cp compose.sample.yml compose.smoketest.yml
perl -pi -e 's#YOUR_OUTPUT_DIR#./output#' compose.smoketest.yml
mkdir -p smoketest_output
perl -pi -e 's#YOUR_OUTPUT_DIR#./smoketest_output#' compose.smoketest.yml

cp .env .env.smoketest
echo "MAX_N=1" >> .env.smoketest
Expand Down
1 change: 0 additions & 1 deletion compose.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ services:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- MAX_N=${MAX_N}
restart: unless-stopped
30 changes: 18 additions & 12 deletions memorymarker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,22 @@ def typer_cli(
only_new: bool = typer.Option(
True, help="Only generate questions from highlights since last run"
),
log_level: str = typer.Option(
"INFO",
help="Log level",
case_sensitive=False,
show_default=True,
envvar="LOG_LEVEL",
),
) -> None:
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
datefmt="%Y/&m/%d %H:%M:%S",
filename="main.log",
)
coloredlogs.install(level=log_level) # type: ignore

output_dir.mkdir(exist_ok=True, parents=True)

logging.info(f"MemoryMarker version {version('memorymarker')}")
Expand Down Expand Up @@ -152,21 +167,12 @@ def typer_cli(

# Write to disk
logging.info("Writing questions to markdown...")
(
Iter(questions)
.groupby(lambda _: _.source_document.title)
.map(lambda _: highlight_group_to_file(output_dir, _))
)
for group in questions.groupby(lambda _: _.source_document.title):
highlight_group_to_file(output_dir, group)

last_run_timestamper.update_timestamp()


if __name__ == "__main__":
load_dotenv()
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
datefmt="%Y/&m/%d %H:%M:%S",
filename="main.log",
)
coloredlogs.install(level="DEBUG") # type: ignore
app()

0 comments on commit 1f68769

Please sign in to comment.