配置manifest.yml

位于Asset compute项目根目录中的manifest.yml描述了此项目中要部署的所有工作程序。

manifest.yml

默认工作人员定义

辅助进程被定义为actions下的Adobe I/O Runtime操作条目,由一组配置组成。

访问其他Adobe I/O集成的工作程序必须将annotations -> require-adobe-auth属性设置为true,因为此通过params.auth对象公开工作程序的Adobe I/O凭据。 当工作进程调用Adobe I/OAPI(例如Adobe Photoshop、Lightroom或Sensei API)时,通常需要此项,并且每个工作进程可以切换。

  1. 打开并查看自动生成的辅助进程manifest.yml。 包含多个Asset compute工作程序的项目,必须为actions数组下的每个工作程序定义一个条目。
packages:
  __APP_PACKAGE__:
    license: Apache-2.0
    actions: # the array of workers, since we have a single worker there is only one entry beneath actions
      worker: # the auto-generated worker definition
        function: actions/worker/index.js # the entry point to the worker
        web: 'yes'  # as our worker is invoked over HTTP from AEM Author service
        runtime: 'nodejs:12' # the target nodejs runtime (only 10 and 12 are supported)
        limits:
          concurrency: 10
        annotations:
          require-adobe-auth: true # set to true, to pass through Adobe I/O access token/client id via params.auth in the worker, typically required when the worker calls out to Adobe I/O APIs such as the Adobe Photoshop, Lightroom or Sensei APIs.

定义限制

每个辅助进程都可以在Adobe I/O Runtime中为其执行上下文配置限制。 应根据工作人员将计算的资产数量、比率、类型以及所执行的工作类型,调整这些值,以便为工作人员提供最佳规模。

在设置限制之前查看Adobe大小调整指南。 asset compute工作程序在处理资源时可能会耗尽内存,从而导致Adobe I/O Runtime执行被终止,因此请确保该工作程序具有适当的大小以处理所有候选资源。

  1. 向新的wknd-asset-compute操作条目添加inputs部分。 这允许调整Asset compute工作程序的总体性能和资源分配。
packages:
  __APP_PACKAGE__:
    license: Apache-2.0
    actions:
      worker:
        function: actions/worker/index.js
        web: 'yes'
        runtime: 'nodejs:12'
        limits: # Allows for the tuning of the worker's performance
          timeout: 60000 # timeout in milliseconds (1 minute)
          memorySize: 512 # memory allocated in MB; if the worker offloads heavy computational work to other Web services this number can be reduced
          concurrency: 10 # adjust based on expected concurrent processing and timeout
        annotations:
          require-adobe-auth: true

完成的manifest.yml

最终manifest.yml如下所示:

packages:
  __APP_PACKAGE__:
    license: Apache-2.0
    actions:
      worker:
        function: actions/worker/index.js
        web: 'yes'
        runtime: 'nodejs:12'
        limits:
          timeout: 60000 # in ms
          memorySize: 512 # in MB
          concurrency: 10
        annotations:
          require-adobe-auth: true

Github上的manifest.yml

Github上的最终.manifest.yml位于:

正在验证manifest.yml

更新生成的Asset computemanifest.yml后,运行本地开发工具并确保使用更新的manifest.yml设置成功启动。

要为Asset compute项目启动Asset compute开发工具,请执行以下操作:

  1. 在Asset compute项目根中打开命令行(在VS代码中,这可以直接在IDE中通过“终端”>“新建终端”打开),然后执行命令:

    code language-none
    $ aio app run
    
  2. 本地Asset compute开发工具将在默认Web浏览器中打开,网址为​ http://localhost:9000

    aio应用运行

  3. 在开发工具初始化时,请观察命令行输出和Web浏览器中的错误消息。

  4. 要停止Asset compute开发工具,请点按执行aio app run的窗口中的Ctrl-C以终止进程。

疑难解答

recommendation-more-help
4859a77c-7971-4ac9-8f5c-4260823c6f69