1
  1. I am deploying an application package which I have stored locally using the command:

    curl --header Content-Type:application/zip --data-binary @application.zip localhost:19071/application/v2/tenant/default/prepareandactivate

And then I am accessing the vespa instance using the pyvespa command:

from vespa.application import Vespa

app = Vespa(url = "http://127.0.0.1", port=8080, deployment_message="Deployment successful for vespa")

But using these commands I am not able to access the application package and neither am I able to use the pyvespa functionalities associated with it.

app.application_package

Throws an error that ValueError: Application package not available.

Using which deployment command can I access the application package?

  1. Other than that I tried using:

    from vespa.application import ApplicationPackage from vespa.package import Schema, Document

    app_package = ApplicationPackage(name="application", schema=[(Schema("test", Document(None, None)))])

And then I am deploying this application package app_package using vespa Docker.

But the problem here is that I am not able to manually change the contents of the application package, like I am not able to add validation_overrides.xml to the application package and redeploy it using the curl command. I used app.application_package.to_files to get the contents of the application package but making changes to it and redeploying using the curl command, doesn't reflect any changes.

curl --header Content-Type:application/zip --data-binary @application.zip localhost:19071/application/v2/tenant/default/prepareandactivate

Can you explain how we can actually make changes to the application package manually without any code and then redeploy it on the same docker instance?

QCoder
  • 89
  • 4

1 Answers1

2

PyVespa can't read an application package - it can only create an application package from Python: https://pyvespa.readthedocs.io/en/latest/getting-started-pyvespa.html#Create-the-application-package

You can query a running Vespa application without the application package, which is what you are doing in the first example: https://pyvespa.readthedocs.io/en/latest/query.html

However, pyvespa can be used to deploy an existing application package, e.g. https://pyvespa.readthedocs.io/en/latest/deploy-docker.html#Deploy-application-package-from-config-files, and it should be possible to edit the files there.

  • Thank you for the reply. I tried the last thing you mentioned. It did create an application package but when I tried to add fields to it using the API: `app.application_package.schema.add_fields()`, it didn't add it to the schema. I used `app.application_package.to_files()`, but it generated some other application package, which is not same as we deployed from the config files. The one which we deployed from config files have different cluster comparison to the one I generated using `to_files`. – QCoder Nov 17 '22 at 10:02
  • I'm not sure I follow. The last thing I mentioned (deploying an existing application package) does not create an application package that can be edited. It only deploys files already on disk. You can change the files outside of pyvespa, then deploy using this method. – Lester Solbakken Nov 22 '22 at 10:11