How do I setup the _SERVER_MODEL_PATH variable? - anaconda

I'm trying to replicate the quickstart save and serve example.
I go to the example folder, run the python script and can see the model runs and artifacts when I type mlflow ui.
However, when I try the mlflow serve command with different model run Ids and ports I get a 404 in my browser, even though the command seems successful:
mlflow models serve -m runs:/e1dabe8fc6e84286af5bee28ca89cdde/model --port 1234
2022/07/11 07:40:01 INFO mlflow.models.cli: Selected backend for flavor 'python_function'
2022/07/11 07:40:02 INFO mlflow.utils.conda: Conda environment mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4 already exists.
2022/07/11 07:40:02 INFO mlflow.pyfunc.backend: === Running command 'conda activate mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4 & waitress-serve --host=127.0.0.1 --port=1234 --ident=mlflow mlflow.pyfunc.scoring_server.wsgi:app'
INFO:waitress:Serving on http://127.0.0.1:1234
I tried running directly from anaconda prompt, and I get the following error:
conda activate mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4 & waitress-serve --host=127.0.0.1 --port=1234 --ident=mlflow mlflow.pyfunc.scoring_server.wsgi:app
Traceback (most recent call last):
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\Scripts\waitress-serve.exe_main.py", line 7, in
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\site-packages\waitress\runner.py", line 283, in run
app = resolve(module, obj_name)
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\site-packages\waitress\runner.py", line 218, in resolve
obj = import(module_name, fromlist=segments[:1])
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\site-packages\mlflow\pyfunc\scoring_server\wsgi.py", line 6, in
app = scoring_server.init(load_model(os.environ[scoring_server._SERVER_MODEL_PATH]))
File "C:\Users\sergio ferro.conda\envs\mlflow-ddf4db606beaa0e9bb42ff0ed98e8f4c4c7cb1f4\lib\os.py", line 679, in getitem
raise KeyError(key) from None
KeyError: 'pyfunc_model_path'
I have tried deleting and creating a new anaconda environment, ran from git bash, anaconda prompt, added anaconda3 environment variables. I know it has something to do with the _SERVER_MODEL_PATH variable but I wouldn't know how to set it up or which path add to my environment variables so it can read this variable from there.

Related

Hyperledger Indy: unable to init node, init_indy_node failed with error

I am following the instruction at https://github.com/hyperledger/indy-node/blob/master/docs/source/start-nodes.md
My OS is Ubuntu 16.04.6 LTS.
I have managed to install indy-node by following
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
sudo bash -c 'echo "deb https://repo.sovrin.org/deb xenial stable" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install indy-node
Now at step2, it says:
set Network name in config file
the location of the config depends on how a Node was installed. It's usually inside /etc/indy for Ubuntu.
the following needs to be added: NETWORK_NAME={network_name} where {network_name} matches the one in genesis transaction files above
I am confused as the document never mentioned any "genesis transaction files" above. So I decide to set NETWORK_NAME = sandbox in my case.
Now I start to generate keys with command init_indy_node Alpha 0.0.0.0 9701 0.0.0.0 9702 --seed 111111111111111111111111111Alpha, and I get the error:
Traceback (most recent call last):
File "/usr/local/bin/init_indy_keys", line 6, in <module>
from plenum.common.keygen_utils import initNodeKeysForBothStacks
File "/usr/local/lib/python3.5/dist-packages/plenum/__init__.py", line 87, in <module>
setup_plugins()
File "/usr/local/lib/python3.5/dist-packages/plenum/__init__.py", line 50, in setup_plugins
config = getConfigOnce()
File "/usr/local/lib/python3.5/dist-packages/plenum/common/config_util.py", line 106, in getConfigOnce
return _getConfig(general_config_dir)
File "/usr/local/lib/python3.5/dist-packages/plenum/common/config_util.py", line 87, in _getConfig
config.GENERAL_CONFIG_FILE))
File "/usr/local/lib/python3.5/dist-packages/plenum/common/config_util.py", line 32, in extend_with_external_config
config = getInstalledConfig(*extender)
File "/usr/local/lib/python3.5/dist-packages/plenum/common/config_util.py", line 26, in getInstalledConfig
spec.loader.exec_module(config)
File "/etc/indy/indy_config.py", line 2, in <module>
NETWORK_NAME = sandbox
NameError: name 'sandbox' is not defined
Can anyone help to create node keys and init them.
I have referred to Hyperledger Indy: Create genesis transaction file and looks like my problem is prior to this.
I have also tried von-network and I am able to start the network in docker image.
The only problem is I am not able to generate my own keys.
Thanks
OK.. Looks like I have found the reason: the indy_config file is actually a .py file, not a "pure" config file like json or yml, I need to add ' for the NETWORK_NAME

Using command/shell modules causes: ValueError: Key name may not begin with an underscore on multiple runs

Ansible throws an error on every task which uses the shell or command modules, but not when running for the first time on a new machine.
The process I use is to image a new raspberry pi, and then use ansible to set up the services that I need. Running ansible for the first time works fine, but if I run it again (without changing anything) it fails, saying ValueError: Key name may not begin with an underscore
Here is an example of a task that throws an error. Running /usr/local/bin/pigpiod -v on the remote machine works as expected/
- name: see if pigpiod is the correct version
command: "/usr/local/bin/pigpiod -v"
register: pigpiod_version
Here is the error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: Key name may not begin with an underscore
fatal: [issacs_box]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/usr/lib/python3.5/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib/python3.5/imp.py\", line 170, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 626, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 673, in exec_module\n File \"<frozen importlib._bootstrap>\", line 222, in _call_with_frames_removed\n File \"/tmp/ansible_command_payload_hc3z4iej/__main__.py\", line 292, in <module>\n File \"/tmp/ansible_command_payload_hc3z4iej/__main__.py\", line 199, in main\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 901, in __init__\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 2243, in _log_invocation\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 2201, in log\n File \"systemd/_journal.pyx\", line 68, in systemd._journal.send\n File \"systemd/_journal.pyx\", line 32, in systemd._journal._send\nValueError: Key name may not begin with an underscore\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
I had the wrong PYPI package installed. Coincidentally, there is a package called systemd (version 0.16.1) which is different from the official systemd-python (version 234) package. Running pip3 uninstall systemd and then pip3 install systemd-python --user solved the problem.
Seems like a weird Ansible bug. What version are you using? Can you try to downgrade and/or upgrade a version. If that would fix this error, please notify the Ansible developers and create an issue at their repo.
Else, try to update and/or downgrade your Python version. It could be that something is wrong with this file /usr/lib/python3.5/imp.py

Ansible: error when deploying playbooks in parallel

i am setting up a kubernetes cluster with ansible.
This is running fine.
Now i usually have 2 or 3 clusters i can test different things with.
Often it happens at some point in time that the cluster/server gots broken. If that happens, i usually recreate the servers and start the playbook again. because this takes some time, i want to be able to run 2 or more playbooks in parallel.
But every time i do this, i get the following error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory
I run my playbook like this:
"$ansible_playbook"
-i "${ANSIBLE_HOSTS}"
"${ANSIBLE_YML}"
--flush-cache
--user root
--become
--become-user root
--ask-sudo-pass
What could be the reason for the error?
I can imagine, that ansible creates some files in the background, used by the different playbooks. But which files could that be?
thx in advance!
Update more detailed error log (-vvv)
ansible-playbook 2.7.8
config file = /home/mod/cod/wo/thingylabs/kubernetes-provisioning/playbooks/test1/ansible.cfg
configured module search path = ['/home/mod/cod/wo/thingylabs/kubernetes-provisioning/vendors/kubespray/library']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
Using /home/mod/cod/wo/thingylabs/kubernetes-provisioning/playbooks/test1/ansible.cfg as config file
SUDO password:
ERROR! Unexpected Exception, this is probably a bug: [Errno 2] No such file or directory
the full traceback was:
Traceback (most recent call last):
File "/usr/bin/ansible-playbook",
exit_code = cli.run()
File "/usr/lib/python3.7/site-packages/ansible/cli/playbook.py", line 104, in run
loader, inventory, variable_manager = self._play_prereqs(self.options)
File "/usr/lib/python3.7/site-packages/ansible/cli/__init__.py", line 786, in _play_prereqs
inventory = InventoryManager(loader=loader, sources=options.inventory)
File "/usr/lib/python3.7/site-packages/ansible/inventory/manager.py", line 148, in __init__
self.parse_sources(cache=True)
File "/usr/lib/python3.7/site-packages/ansible/inventory/manager.py", line 207, in parse_sources
source = unfrackpath(source, follow=False)
File "/usr/lib/python3.7/site-packages/ansible/utils/path.py", line 47, in unfrackpath
basedir = op.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

FileNotFoundError: [Errno 2] No such file or directory: while deleting the minidcos vagrant cluster

I have created local minidcos vagrant cluster using below command.
$ sudo minidcos vagrant create ./dcos_generate_config.sh --agents 0
The above command is not successful. It is failed abruptly due to No space left on device.
when I list the cluster I see the cluster exists.
$ sudo minidcos vagrant list
default
I'm not able to access the cluster using sudo minidcos vagrant web. I get the same error when I tried to destroy the cluster as below -
$ sudo minidcos vagrant destroy
Traceback (most recent call last):
File "/usr/local/bin/minidcos", line 10, in <module>
sys.exit(minidcos())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/destroy.py", line 59, in destroy
cluster_vms.destroy()
File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 294, in destroy
self.vagrant_client.destroy()
File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 274, in vagrant_client
item for item in self.workspace_dir.iterdir()
File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 274, in <listcomp>
item for item in self.workspace_dir.iterdir()
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 1074, in iterdir
for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/acaa37838a534dc0ae51c3fcc059f650'
How can I successfully delete the cluster?
The issue here was that the workspace directory was deleted, and yet the VMs were still detected.
The workspace is configurable as per the documentation.
This could happen because the workspace directory is somehow deleted while the VMs are running, but it also happens when the host is shut down (assuming the default workspace temporary directory is used).
The behaviour is now changed as of minidcos version 2019.04.08.1.
In particular, minidcos vagrant list no longer lists VMs which are not in the running state.
There is also a new minidcos vagrant clean command which cleans all VMs and leftover VMs.

Deploy Laravel on Cloud Foundry

I`m trying to deploy Laravel on Cloud Foundry, but at the end, it failed.
I followed this tutorial step by step. Also, I tried to solve my problem by this question but it doesn't work for me. And the overall view of my app is looks like this
However this is the errors, when I push the app to cf:
WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.
WARNING: The version defined in `composer.json` will be used.
The extension 'fpm' is not provided by this buildpack.
The extension 'tokenizer' is not provided by this buildpack.
[ErrorException]
file_put_contents(/tmp/app/htdocs/bootstrap/cache/services.json): failed to open stream: No such file or directory
-----> Composer command failed
Traceback (most recent call last):
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/scripts/compile.py", line 50, in <module>
.from_build_pack('lib/additional_commands')
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/builder.py", line 208, in extensions
process_extension(path, ctx, 'compile', process, args=[self])
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/utils.py", line 69, in process_extension
success(getattr(extn, to_call)(*args))
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 414, in compile
return composer.compile(install)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/extension_helpers.py", line 154, in compile
self._compile(install)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 181, in _compile
self.run()
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 316, in run
*self._ctx['COMPOSER_INSTALL_OPTIONS'])
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 360, in run
shell=True)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/runner.py", line 109, in stream_output
raise CalledProcessError(retcode, cmd)
build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7fa7340816f0>' returned non-zero exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
I need your help to solve this issue!

Resources