<commit_before>SHELL := /bin/bash

ENGINE_PID_FILE := /var/run/lovelace-engine.pid
ENGINE_PORT := 14714

# Production
# PYTHON37 := /root/anaconda3/envs/lovelace_engine_env/bin/python
# GUNICORN := /root/anaconda3/envs/lovelace_engine_env/bin/gunicorn

# Development VM
PYTHON37 := /usr/local/bin/python3
GUNICORN := /usr/local/bin/gunicorn

prepare-venv: clean
	@echo "Preparing virtual environment..."
	@echo "Not implemented..."

update-requirements:
	@echo "Updating environment requirements..."

start-engine: stop-engine
	@echo "Starting the Lovelace Engine in the foreground..."
	$(PYTHON37) $(GUNICORN) --workers 1 --log-level debug --timeout 600 --preload --reload --bind localhost:$(ENGINE_PORT) engine.api:app

stop-engine:
	@echo "Stopping the Lovelace Engine gracefully..."
	if [ -a $(ENGINE_PID_FILE) ]; then kill -15 `cat $(ENGINE_PID_FILE)` ; sudo rm -f $(ENGINE_PID_FILE) ; fi;
	@echo "Deleting linux containers by force..."
	-lxc list -c n | grep lovelace | cut -d " " -f2 | xargs --no-run-if-empty lxc delete --force

test:
	@echo "Make sure the engine is running!"
	@echo "Running tests..."
	cd engine ; $(PYTHON37) -m unittest test_api.py

clean:
	@echo "Deleting old virtual environment..."
	@echo "Not implemented..."<commit_msg>Update makefile to use pytest<commit_after>SHELL := /bin/bash

ENGINE_PID_FILE := /var/run/lovelace-engine.pid
ENGINE_PORT := 14714

# Production
# PYTHON37 := /root/anaconda3/envs/lovelace_engine_env/bin/python
# GUNICORN := /root/anaconda3/envs/lovelace_engine_env/bin/gunicorn

# Development VM
PYTHON37 := /usr/local/bin/python3
GUNICORN := /usr/local/bin/gunicorn

prepare-venv: clean
	@echo "Preparing virtual environment..."
	@echo "Not implemented..."

update-requirements:
	@echo "Updating environment requirements..."

start-engine: stop-engine
	@echo "Starting the Lovelace Engine in the foreground..."
	$(PYTHON37) $(GUNICORN) --workers 1 --log-level debug --timeout 600 --preload --reload --bind localhost:$(ENGINE_PORT) engine.api:app

stop-engine:
	@echo "Stopping the Lovelace Engine gracefully..."
	if [ -a $(ENGINE_PID_FILE) ]; then kill -15 `cat $(ENGINE_PID_FILE)` ; sudo rm -f $(ENGINE_PID_FILE) ; fi;
	@echo "Deleting linux containers by force..."
	-lxc list -c n | grep lovelace | cut -d " " -f2 | xargs --no-run-if-empty lxc delete --force

test:
	@echo "Make sure the engine is running!"
	@echo "Running tests..."
	@echo "Note: if using non-default paths, set the env variable LOVELACE_SOLUTIONS_DIR"
	@echo "Note: if using non-default engine URL and port, set the env var LOVELACE_ENGINER_URI"
	cd tests ; pytest

clean:
	@echo "Deleting old virtual environment..."
	@echo "Not implemented..."
{'fraction_non_alphanumeric': 0.14039685511044553, 'fraction_numerical': 0.01647323099962561, 'mean_word_length': 4.01313320825516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '688568', 'n_tokens_mistral': 1012, 'n_tokens_neox': 942, 'n_words': 265}