Skip to content

Commit 585b272

Browse files
authored
moving from using pip module to submodules (#668)
* moving from using pip module to submodules * using a conditional so script doesn't error out if file doesn't exist
1 parent c0e6d39 commit 585b272

9 files changed

Lines changed: 13 additions & 32 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,3 @@ logs/
163163

164164
.idea/
165165

166-
wall_e/wall_e_models

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "wall_e_models"]
2+
path = .wall_e_models
3+
url = https://github.com/CSSS/wall_e_models.git

.run_walle.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ def create_argument_parser():
4646
choices=[DatabaseType.sqlite3.value, DatabaseType.postgreSQL.value],
4747
help="indicates whether you want to use sqlite3 or postgres for the database type."
4848
)
49-
parser_obj.add_argument(
50-
"--wall_e_models_location", action='store', default=None,
51-
help="used to specify the absolute path to the wall_e_models", metavar="/path/to/wall_e_model/repo"
52-
)
5349
parser_obj.add_argument(
5450
"--launch_wall_e", action='store', default=None, choices=['true', 'false'], help="script will run wall_e."
5551
)
@@ -84,7 +80,6 @@ def pull_variable_from_command_line_arguments(argparser):
8480
:return: (
8581
the dockerized_wall_e command-line flag
8682
the database type command-line flag
87-
the wall_e_models location
8883
the launch_wall_e command-line flag
8984
the install_requirements command-line flag
9085
the setup_database command-line flag
@@ -97,7 +92,7 @@ def pull_variable_from_command_line_arguments(argparser):
9792
database_type = DatabaseType.postgreSQL.value
9893
return (
9994
convert_command_line_argument_to_menu_format(argparser.dockerized_wall_e), database_type,
100-
argparser.wall_e_models_location, convert_command_line_argument_to_menu_format(argparser.launch_wall_e),
95+
convert_command_line_argument_to_menu_format(argparser.launch_wall_e),
10196
convert_command_line_argument_to_menu_format(argparser.install_requirements),
10297
convert_command_line_argument_to_menu_format(argparser.setup_database)
10398

@@ -280,7 +275,7 @@ def take_user_input_for_string_variable(message, description=None, default_value
280275

281276
(
282277
basic_config__DOCKERIZED_CMD_LINE_ARGUMENT, database_config__TYPE_CMD_LINE_ARGUMENT,
283-
WALL_E_MODEL_PATH_CMD_LINE_ARGUMENT, LAUNCH_WALL_E_CMD_LINE_ARGUMENT, INSTALL_REQUIREMENTS_CMD_LINE_ARGUMENT,
278+
LAUNCH_WALL_E_CMD_LINE_ARGUMENT, INSTALL_REQUIREMENTS_CMD_LINE_ARGUMENT,
284279
SETUP_DATABASE_CMD_LINE_ARGUMENT
285280
) = pull_variable_from_command_line_arguments(args)
286281

@@ -329,16 +324,6 @@ def take_user_input_for_string_variable(message, description=None, default_value
329324
print("Feel free to add that feature in or revert to using db.sqlite3")
330325
exit(1)
331326

332-
WALL_E_MODEL_PATH = WALL_E_MODEL_PATH_CMD_LINE_ARGUMENT
333-
while WALL_E_MODEL_PATH is None or not os.path.exists(WALL_E_MODEL_PATH):
334-
WALL_E_MODEL_PATH = get_string_variables(
335-
"Please specify the relative/absolute path for the wall_e_model in the form /path/to/wall_e_model/repo",
336-
"WALL_E_MODEL_PATH",
337-
command_line_argument=WALL_E_MODEL_PATH, overwrite_env=overwrite_env_file,
338-
default_value=WALL_E_MODEL_PATH
339-
)
340-
if WALL_E_MODEL_PATH is not None and not os.path.exists(WALL_E_MODEL_PATH):
341-
print(f"path {WALL_E_MODEL_PATH} does not exist")
342327
LAUNCH_WALL_E = get_boolean_variable(
343328
"Do you you want this script to launch wall_e? [the alternative is to use PyCharm]", "LAUNCH_WALL_E",
344329
command_line_argument=LAUNCH_WALL_E_CMD_LINE_ARGUMENT, overwrite_env=overwrite_env_file
@@ -396,7 +381,7 @@ def take_user_input_for_string_variable(message, description=None, default_value
396381

397382
essential_variables_are_null = check_for_null_variables(
398383
basic_config__TOKEN=basic_config__TOKEN, basic_config__GUILD_ID=basic_config__GUILD_ID,
399-
basic_config__DOCKERIZED=basic_config__DOCKERIZED, WALL_E_MODEL_PATH=WALL_E_MODEL_PATH
384+
basic_config__DOCKERIZED=basic_config__DOCKERIZED
400385
)
401386
if essential_variables_are_null[0]:
402387
raise Exception(f"necessary variable {essential_variables_are_null[1]} is None")
@@ -447,7 +432,6 @@ def take_user_input_for_string_variable(message, description=None, default_value
447432
with open(RUN_ENV_FILE_LOCATION, "w") as f:
448433
f.seek(0)
449434
f.write(f"""LAUNCH_WALL_E='{LAUNCH_WALL_E}'
450-
WALL_E_MODEL_PATH='{WALL_E_MODEL_PATH}'
451435
POSTGRES_PASSWORD='postgres_passwd'
452436
ORIGIN_IMAGE='sfucsssorg/wall_e'
453437
HELP_SELECTED='0'

.wall_e_models

Submodule .wall_e_models added at ff65269

CI/validate_and_deploy/2_deploy/server_scripts/Dockerfile.wall_e

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ COPY CI/validate_and_deploy/2_deploy/create-database.ddl .
88

99
COPY CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh .
1010

11-
COPY CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt .
12-
1311
RUN apk add --no-cache tzdata # https://github.com/docker-library/postgres/issues/220
1412

1513
CMD ["./wait-for-postgres.sh", "db", "python", "./main.py" ]

CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ if [[ "${basic_config__ENVIRONMENT}" == "TEST" ]]; then
2626
--set=WALL_E_DB_PASSWORD="${database_config__WALL_E_DB_PASSWORD}" \
2727
--set=WALL_E_DB_DBNAME="${database_config__WALL_E_DB_DBNAME}" \
2828
-h "$host" -U "postgres" -f "${HOME_DIR}"/create-database.ddl
29-
python3 -m pip install -r ../CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt
3029
python3 django_manage.py migrate
3130
wget https://dev.sfucsss.org/wall_e/fixtures/banrecords.json
3231
wget https://dev.sfucsss.org/wall_e/fixtures/commandstats.json
@@ -45,7 +44,6 @@ if [[ "${basic_config__ENVIRONMENT}" == "TEST" ]]; then
4544
rm -r /wall_e || true
4645
fi
4746

48-
python3 -m pip install -r wall_e_models_requirement.txt
4947
python3 django_manage.py migrate
5048

5149
exec $cmd

CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

run_walle.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ fi
1010

1111
# need to delete and re-create so that the if statement that tries to detected if the
1212
# help menu was invoked can work correctly
13-
cat ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env | grep -v HELP_SELECTED > ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2
14-
mv ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env
13+
if [ -f "CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env" ]; then
14+
cat ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env | grep -v HELP_SELECTED > ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2
15+
mv ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env
16+
fi
1517

1618
./.run_walle.py $@
1719

@@ -42,11 +44,7 @@ else
4244
python3 -m pip install -r layer-2-requirements.txt
4345
rm layer-1-requirements.txt layer-2-requirements.txt
4446
python3 -m pip install -r requirements.txt
45-
python3 -m pip install -r ../CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt
46-
python3 -m pip uninstall -y wall_e_models
47-
fi
48-
if [ ! -f 'wall_e_models' ]; then
49-
ln -sn "${WALL_E_MODEL_PATH}/wall_e_models" wall_e_models || true
47+
python3 -m pip install -r ../.wall_e_models/requirements.txt
5048
fi
5149

5250
if [[ "${SETUP_DATABASE}" == "True" ]]; then

wall_e/wall_e_models

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.wall_e_models/wall_e_models

0 commit comments

Comments
 (0)