workflowcloudify

cloudify custom workflow missing cloudify_agent runtime information


I want to develop my own workflow named "backup" in cloudify with my own plugin, but when i ran that workflow, the below error occured

'backup' workflow execution failed: RuntimeError: Workflow failed: Task failed 'script_runner.tasks.run' -> Missing cloudify_agent runtime information. This most likely means that the Compute node never started successfully

I don't understand why, anybody can solved me this problem? Here is my main blueprint code and plugin code

My main blueprint

tosca_definitions_version: cloudify_dsl_1_2

imports:
  - plugins/backup.yaml
  - types/types.yaml

node_templates:

  mynode:
    type: cloudify.nodes.Compute
    properties:
      ip: "ip"
      agent_config:
        install_method: none
        user: "user"
        key: "key_uri"

  myapp:
    type: cloudify.nodes.ApplicationModule
    interfaces:
      test_platform_backup:
        backup:
          implementation: scripts/backup.sh
          inputs:
            port: 6969
        post_backup:
          implementation: scripts/post_backup.sh
    relationships:
      - type: cloudify.relationships.contained_in
        target: mynode

My plugin code:

from cloudify.decorators import workflow
from cloudify.workflows import ctx
from cloudify.workflows.tasks_graph import forkjoin

@workflow
def backup(operation, type_name, operation_kwargs, is_node_operation, **kwargs):
    graph = ctx.graph_mode()

    send_event_starting_tasks = {}
    send_event_done_tasks = {}

    for node in ctx.nodes:
        if type_name in node.type_hierarchy:
            for instance in node.instances:
                send_event_starting_tasks[instance.id] = instance.send_event('Starting to run operation')
                send_event_done_tasks[instance.id] = instance.send_event('Done running operation')

    for node in ctx.nodes:
        if type_name in node.type_hierarchy:
            for instance in node.instances:

                sequence = graph.sequence()

                if is_node_operation:
                    operation_task = instance.execute_operation(operation, kwargs=operation_kwargs)
                else:
                    forkjoin_tasks = []
                    for relationship in instance.relationships:
                        forkjoin_tasks.append(relationship.execute_source_operation(operation))
                        forkjoin_tasks.append(relationship.execute_target_operation(operation))
                    operation_task = forkjoin(*forkjoin_tasks)

                sequence.add(
                    send_event_starting_tasks[instance.id],
                    operation_task,
                    send_event_done_tasks[instance.id])

    for node in ctx.nodes:
        for instance in node.instances:
            for rel in instance.relationships:

                instance_starting_task = send_event_starting_tasks.get(instance.id)
                target_done_task = send_event_done_tasks.get(rel.target_id)

                if instance_starting_task and target_done_task:
                    graph.add_dependency(instance_starting_task, target_done_task)

    return graph.execute()

Solution

  • It seems that your VM did not start.

    From your code I can't understand what you are trying to do. You don't install and agent and you don't have a fabric connection to the VM, yet you are trying to run operations on the VM.

    You should either install an agent, E.g remove the "install_method: none", or add a fabric connection to the VM and run the operations with it.