Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_api interface is cumbersome and error-prone #3870

Closed
ltalirz opened this issue Mar 26, 2020 · 1 comment · Fixed by #3875
Closed

run_api interface is cumbersome and error-prone #3870

ltalirz opened this issue Mar 26, 2020 · 1 comment · Fixed by #3875

Comments

@ltalirz
Copy link
Member

ltalirz commented Mar 26, 2020

The current run_api interface for running the AiiDA REST API has unnecessarily many parameters, making it complicated to use in WSGI scripts, e.g.:

from aiida.restapi import api
from aiida.restapi.run_api import run_api
import aiida.restapi

CONFIG_DIR = os.path.join(os.path.split(os.path.abspath(aiida.restapi.__file__))[0], 'common')

(app, api) = run_api(api.App,
                             api.AiidaApi,
                             hostname="localhost",
                             port=5000,
                             config=CONFIG_DIR,
                             debug=False,
                             wsgi_profile=False,
                             hookup=False,
                             catch_internal_server=False)

While all but the first two parameters are keyword arguments, the code will actually crash if they are not provided.

In reality, there is no reason to have to specify any parameters whatsoever and one should simply be able to call run_api().

@sphuber
Copy link
Contributor

sphuber commented Mar 29, 2020

Fixed in PR #3875

@sphuber sphuber closed this as completed Mar 29, 2020
@sphuber sphuber added this to the v1.1.2 milestone Apr 1, 2020
@sphuber sphuber modified the milestones: v1.1.2, v1.2.0 Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment