-
Notifications
You must be signed in to change notification settings - Fork 214
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
Issue with local load_profile and %verdi magic #5822
Comments
hey @chrisjsewell It seems that the verdi command is trying to load a default profile but it cannot find any profiles in the ~/.aiida/config.json file. One solution could be to create a new profile using the verdi profile command and set it as the default profile. Here are the steps: javascript : php: |
Heya @Deepanshu7777777 |
Just to mention that I had a related issue in #5940 . The tests were running fine, but the RTD build was failing, because the tutorial notebook was excepting in the ---------------------------------------------------------------------------
ProfileConfigurationError Traceback (most recent call last)
Cell In[11], line 1
----> 1 get_ipython().run_line_magic('verdi', 'process list')
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/IPython/core/interactiveshell.py:2414, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
2412 kwargs['local_ns'] = self.get_local_scope(stack_depth)
2413 with self.builtin_trap:
-> 2414 result = fn(*args, **kwargs)
2416 # The code below prevents the output from being displayed
2417 # when using magics with decodator @output_can_be_silenced
2418 # when the last Python token in the expression is a ';'.
2419 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/tools/ipython/ipython_magics.py:76, in AiiDALoaderMagics.verdi(self, line, local_ns)
74 profile = get_profile()
75 obj = AttributeDict({'config': config, 'profile': profile})
---> 76 return verdi(shlex.split(line), prog_name='%verdi', obj=obj, standalone_mode=False)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:1130, in BaseCommand.__call__(self, *args, **kwargs)
1128 def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
1129 """Alias for :meth:`main`."""
-> 1130 return self.main(*args, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:1055, in BaseCommand.main(self, args, prog_name, complete_var, standalone_mode, windows_expand_args, **extra)
1053 try:
1054 with self.make_context(prog_name, args, **extra) as ctx:
-> 1055 rv = self.invoke(ctx)
1056 if not standalone_mode:
1057 return rv
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:1657, in MultiCommand.invoke(self, ctx)
1655 sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
1656 with sub_ctx:
-> 1657 return _process_result(sub_ctx.command.invoke(sub_ctx))
1659 # In chain mode we create the contexts step by step, but after the
1660 # base command has been invoked. Because at that point we do not
1661 # know the subcommands yet, the invoked subcommand attribute is
1662 # set to ``*`` to inform the command that subcommands are executed
1663 # but nothing else.
1664 with ctx:
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:1657, in MultiCommand.invoke(self, ctx)
1655 sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
1656 with sub_ctx:
-> 1657 return _process_result(sub_ctx.command.invoke(sub_ctx))
1659 # In chain mode we create the contexts step by step, but after the
1660 # base command has been invoked. Because at that point we do not
1661 # know the subcommands yet, the invoked subcommand attribute is
1662 # set to ``*`` to inform the command that subcommands are executed
1663 # but nothing else.
1664 with ctx:
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:1404, in Command.invoke(self, ctx)
1401 echo(style(message, fg="red"), err=True)
1403 if self.callback is not None:
-> 1404 return ctx.invoke(self.callback, **ctx.params)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/click/core.py:760, in Context.invoke(_Context__self, _Context__callback, *args, **kwargs)
758 with augment_usage_errors(__self):
759 with ctx:
--> 760 return __callback(*args, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/cmdline/utils/decorators.py:73, in with_dbenv.<locals>.wrapper(wrapped, _, args, kwargs)
70 except (IntegrityError, ConfigurationError, LockedProfileError) as exception:
71 echo.echo_critical(str(exception))
---> 73 return wrapped(*args, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/cmdline/commands/cmd_process.py:97, in process_list(all_entries, group, process_state, process_label, paused, exit_status, failed, past_days, limit, project, raw, order_by, order_dir)
94 echo.echo(f'\nTotal results: {len(projected)}\n')
95 print_last_process_state_change()
---> 97 if not get_daemon_client().is_daemon_running:
98 echo.echo_warning('the daemon is not running', bold=True)
99 else:
100 # Second query to get active process count
101 # Currently this is slow but will be fixed with issue #2770
102 # We place it at the end so that the user can Ctrl+C after getting the process table.
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/engine/daemon/client.py:80, in get_daemon_client(profile_name)
71 """Return the daemon client for the given profile or the current profile if not specified.
72
73 :param profile_name: Optional profile name to load.
(...)
77 :raises aiida.common.ProfileConfigurationError: if the given profile does not exist.
78 """
79 profile = get_manager().load_profile(profile_name)
---> 80 return DaemonClient(profile)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/engine/daemon/client.py:98, in DaemonClient.__init__(self, profile)
96 self._profile = profile
97 self._socket_directory: str | None = None
---> 98 self._daemon_timeout: int = config.get_option('daemon.timeout', scope=profile.name)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/manage/configuration/config.py:457, in Config.get_option(self, option_name, scope, default)
454 default_value = option.default if default and option.default is not NO_DEFAULT else None
456 if scope is not None:
--> 457 value = self.get_profile(scope).get_option(option.name, default_value)
458 else:
459 value = self.options.get(option.name, default_value)
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/manage/configuration/config.py:309, in Config.get_profile(self, name)
306 if not name:
307 name = self.default_profile_name
--> 309 self.validate_profile(name)
311 return self._profiles[name]
File ~/checkouts/readthedocs.org/user_builds/aiida-core/envs/5940/lib/python3.8/site-packages/aiida/manage/configuration/config.py:291, in Config.validate_profile(self, name)
288 from aiida.common import exceptions
290 if name not in self.profile_names:
--> 291 raise exceptions.ProfileConfigurationError(f'profile `{name}` does not exist')
ProfileConfigurationError: profile `myprofile` does not exist The offending line that was introduced by the PR was self._daemon_timeout: int = config.get_option('daemon.timeout', scope=profile.name) The original code: self._daemon_timeout: int = config.get_option('daemon.timeout') ran without issues. It is not clear to me why the Maybe this can help in finding the cause for the build failing locally but not on ReadTheDocs. |
Found the problem. The notebook creates a temporary profile on the fly and loads it. However, it is not actually added to the The cause of the OP of this issue is very similar. Except there, when |
Locally running the docs build, and thus the tutorial notebook execution, there is now (I don't believe this was originally the case) an issue; that the
Config
does not appear to be "loaded" with the profile, and so verdi tries to load a local default profile.The text was updated successfully, but these errors were encountered: