Remote Flow

JinaD enables management of (remote + containerized) Flows with all your dependencies via REST APIs.

Create Flow (redoc)

This creates a new container using the base image, connects it to the network defined by workspace_id and starts a Flow inside the container. Only the ports needed for external communication are mapped to local. Make sure you’ve added all your config files while creating the workspace in the previous step.

  1. from daemon.clients import JinaDClient
  2. client = JinaDClient(host=HOST, port=PORT)
  3. client.flows.create(workspace_id=workspace_id, filename='my_awesome_flow.yml')
  4. # jflow-a71cc28f-a5db-4cc0-bb9e-bb7797172cc9

Get details of Flow (redoc)

  1. client.flows.get(flow_id)
  1. {
  2. "time_created": "2021-07-27T05:12:06.646809",
  3. "metadata": {
  4. "container_id": "8770817435",
  5. "container_name": "jflow-a71cc28f-a5db-4cc0-bb9e-bb7797172cc9",
  6. "image_id": "28bd40a87e",
  7. "network": "6363b4a5b8",
  8. "ports": {
  9. "23456/tcp": 23456,
  10. "51567/tcp": 51567
  11. },
  12. "uri": "http://host.docker.internal:51567"
  13. },
  14. "arguments": {
  15. "object": {
  16. "time_created": "2021-07-27T05:12:06.640236",
  17. "arguments": {
  18. "port_expose": 23456,
  19. "name": None,
  20. "workspace": "./",
  21. "log_config": "/usr/local/lib/python3.7/site-packages/jina/resources/logging.default.yml",
  22. "quiet": False,
  23. "quiet_error": False,
  24. "workspace_id": "9db7a919-dfa5-420c-834e-ab940a40cbf2",
  25. "uses": None,
  26. "env": None,
  27. "inspect": 2
  28. },
  29. "yaml_source": "jtype: Flow\nversion: "1.0"\nwith:\n protocol: http\n port_expose: 23456\nexecutors:\n - name: executor_ex\n"
  30. },
  31. "command": "--port-expose 51567 --mode flow --workspace-id 4d0a0db5-2cb8-4e8f-8183-966681c1c863"
  32. },
  33. "workspace_id": "jworkspace-4d0a0db5-2cb8-4e8f-8183-966681c1c863"
  34. }

Terminate Flow (redoc)

  1. assert client.flows.delete(flow_id)