Skip to content

Commit

Permalink
Set cache directory in the services
Browse files Browse the repository at this point in the history
  • Loading branch information
VisLab committed Jun 23, 2022
1 parent f49cad3 commit 60cb89c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions hedweb/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,7 @@ def render(pieces, style):
raise ValueError("unknown style '%s'" % style)

return {"version": rendered, "full-revisionid": pieces["long"],
"dirty": pieces["dirty"], "error": None,
"date": pieces.get("date")}
"dirty": pieces["dirty"], "error": None, "date": pieces["date"]}


def get_versions():
Expand Down
14 changes: 14 additions & 0 deletions hedweb/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
app_config = current_app.config
route_blueprint = Blueprint(route_constants.ROUTE_BLUEPRINT, __name__)

# with app.app_context():
# from hedweb.routes import route_blueprint
#
# app.register_blueprint(route_blueprint, url_prefix=app.config['URL_PREFIX'])
# os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
#
# app.config['VERSIONS'] = get_version_dict()
# print(f"Versions: {app.config['VERSIONS']}")
# print(f"Using cache directory {app.config['HED_CACHE_FOLDER']}")
#
# hedschema.set_cache_directory(app.config['HED_CACHE_FOLDER'])
#
# hedschema.set_cache_directory(app_config[])

@route_blueprint.route(route_constants.COLUMNS_INFO_ROUTE, methods=['POST'])
def columns_info_results():
Expand Down Expand Up @@ -121,6 +134,7 @@ def services_results():
"""

try:
hedschema.set_cache_directory(current_app.config['HED_CACHE_FOLDER'])
arguments = services.get_input_from_request(request)
response = services.process(arguments)
return json.dumps(response)
Expand Down
1 change: 1 addition & 0 deletions hedweb/web_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def get_hed_schema_from_pull_down(request):
if base_constants.SCHEMA_VERSION not in request.form:
raise HedFileError("NoSchemaError", "Must provide a valid schema or schema version", "")
elif request.form[base_constants.SCHEMA_VERSION] != base_constants.OTHER_VERSION_OPTION:

hed_file_path = hedschema.get_path_from_hed_version(request.form[base_constants.SCHEMA_VERSION])
hed_schema = hedschema.load_schema(hed_file_path)
elif request.form[base_constants.SCHEMA_VERSION] == \
Expand Down

0 comments on commit 60cb89c

Please sign in to comment.