### Pip download output example Source: https://d7y.io/docs/operations/integrations/pip This is an example of the expected output when pip downloads a package through the Dragonfly proxy, showing the collection and installation process. ```text Looking in indexes: https://pypi.org/simple/ Collecting torch Using cached torch-2.5.1-cp311-cp311-manylinux2014_aarch64.whl (91.9 MB) Collecting filelock Using cached filelock-3.17.0-py3-none-any.whl (16 kB) Collecting typing-extensions>=4.8.0 Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB) Collecting networkx Downloading networkx-3.4.2-py3-none-any.whl (1.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 195.8 MB/s eta 0:00:00 Collecting jinja2 Downloading jinja2-3.1.5-py3-none-any.whl (134 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.6/134.6 kB 38.5 MB/s eta 0:00:00 Collecting fsspec Downloading fsspec-2024.12.0-py3-none-any.whl (183 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 183.9/183.9 kB 37.5 MB/s eta 0:00:00 Collecting sympy==1.13.1 Downloading sympy-1.13.1-py3-none-any.whl (6.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 MB 245.3 MB/s eta 0:00:00 Collecting mpmath<1.4,>=1.1.0 Downloading mpmath-1.3.0-py3-none-any.whl (536 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 170.5 MB/s eta 0:00:00 Collecting MarkupSafe>=2.0 Downloading MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (23 kB) Installing collected packages: mpmath, typing-extensions, sympy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch Successfully installed MarkupSafe-3.0.2 filelock-3.17.0 fsspec-2024.12.0 jinja2-3.1.5 mpmath-1.3.0 networkx-3.4.2 sympy-1.13.1 torch-2.5.1 typing-extensions-4.12.2 ``` -------------------------------- ### Start Minikube with Podman Source: https://d7y.io/docs/operations/integrations/container-runtime/podman Use this command to start a Minikube cluster with Podman as the container runtime. ```bash minikube start --driver=podman --container-runtime=cri-o ``` -------------------------------- ### Start Minikube with CRI-O Source: https://d7y.io/docs/operations/integrations/container-runtime/cri-o Use this command to start a Minikube cluster with CRI-O as the container runtime. Ensure CRI-O is installed and configured on your system. ```bash minikube start --container-runtime=cri-o ``` -------------------------------- ### Run Scheduler CLI Source: https://d7y.io/docs/getting-started/installation/binaries View Scheduler CLI help documentation or start the Scheduler service. ```bash # View Scheduler cli help docs. scheduler --help # Setup Scheduler, it is recommended to start Scheduler via systemd. scheduler ``` -------------------------------- ### Run Manager CLI Source: https://d7y.io/docs/getting-started/installation/binaries View Manager CLI help documentation or start the Manager service. ```bash # View Manager cli help docs. manager --help # Setup Manager, it is recommended to start Manager via systemd. manager ``` -------------------------------- ### Install Python package with pip Source: https://d7y.io/docs/operations/integrations/pip Use the `pip install` command to download and install a Python package, such as `torch`. Pip will now use the configured Dragonfly proxy. ```bash pip install torch ``` -------------------------------- ### Install Dragonfly with Helm Source: https://d7y.io/docs/operations/integrations/container-runtime/podman Install the Dragonfly cluster using Helm charts and the provided values.yaml configuration file. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f values.yaml ``` -------------------------------- ### Install Dragonfly with Helm Source: https://d7y.io/docs/getting-started/installation/helm-charts Add the Dragonfly Helm repository and install the Dragonfly chart using the prepared values.yaml file. This command creates the dragonfly-system namespace if it doesn't exist. ```bash helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f values.yaml ``` -------------------------------- ### Manager YAML Configuration Example Source: https://d7y.io/docs/reference/configuration/manager This snippet shows a comprehensive example of the manager.yaml configuration file. It includes settings for gRPC and REST servers, logging, authentication, and database connections. Use this as a template for your own manager configuration. ```yaml # Current server info used for server. server: # GRPC server configure. grpc: # # Access ip for other services, # # when local ip is different with access ip, advertiseIP should be set. # advertiseIP: 127.0.0.1 # # Listen ip. # listenIP: 0.0.0.0 # Listen port. # when this port is not available, manager will try next port. port: start: 65003 end: 65003 # RequestRateLimit is the maximum number of requests per second for the gRPC server. It limits both the rate of # unary gRPC requests and the rate of new stream gRPC connection, default is 4000 req/s. requestRateLimit: 4000 # # GRPC server tls configuration. # tls: # # CA certificate file path for mTLS. # caCert: /etc/ssl/certs/ca.crt # # Certificate file path for mTLS. # cert: /etc/ssl/certs/server.crt # # Key file path for mTLS. # key: /etc/ssl/private/server.pem # REST server configure rest: # REST server address addr: :8080 # # REST server tls configuration. # tls: # # Certificate file path. # cert: /etc/ssl/certs/server.crt # # Key file path. # key: /etc/ssl/private/server.pem # logLevel specifies the logging level for the manager. # Default: "info" # Supported values: "debug", "info", "warn", "error", "panic", "fatal" logLevel: "info" # logMaxSize specifies maximum size in megabytes of log files before rotation for the manager. # Default: 1024 logMaxSize: 1024 # logMaxAge specifies maximum number of days to retain old log files for the manager. # Default: 7 logMaxAge: 7 # logMaxBackups specifies maximum number of old log files to keep for the manager. # Default: 20 logMaxBackups: 20 # logDir is the log directory. # In linux, default value is /var/log/dragonfly. # In macos(just for testing), default value is /Users/$USER/.dragonfly/logs. logDir: '' # cacheDir is dynconfig cache directory. # In linux, default value is /var/cache/dragonfly. # In macos(just for testing), default value is /Users/$USER/.dragonfly/cache. cacheDir: '' # pluginDir is the plugin directory. # In linux, default value is /usr/local/dragonfly/plugins. # In macos(just for testing), default value is /Users/$USER/.dragonfly/plugins. pluginDir: '' # dataDir is the data directory. # In linux, default value is /usr/local/dragonfly/data. # In macos(just for testing), default value is /Users/$USER/.dragonfly/data. dataDir: '' # Auth configuration. auth: # JWT configuration used for signing. jwt: # Realm name to display to the user, default value is Dragonfly. realm: 'Dragonfly' # Key is secret key used for signing, default value is # encoded base64 of dragonfly. # Please change the key in production. key: 'ZHJhZ29uZmx5Cg==' # Timeout is duration that a jwt token is valid, # default duration is two days. timeout: 48h # MaxRefresh field allows clients to refresh their token # until MaxRefresh has passed, default duration is two days. maxRefresh: 48h # Database info used for server. database: # Database type, supported types include mysql, mariadb and postgres. type: mysql # Mysql configure. mysql: user: dragonfly password: dragonfly host: dragonfly port: 3306 dbname: manager migrate: true # Postgres configure. postgres: user: dragonfly password: dragonfly host: dragonfly port: 5432 dbname: manager sslMode: disable timezone: UTC migrate: true # tlsConfig: preferred # tls: # # Client certificate file path. # cert: /etc/ssl/certs/cert.pem # # Client key file path. # key: /etc/ssl/private/key.pem # # CA file path. # ca: /etc/ssl/certs/ca.pem # # Whether a client verifies the server's certificate chain and hostname. # insecureSkipVerify: true # Redis configure. redis: # Redis addresses. addrs: - dragonfly:6379 # Redis sentinel master name. masterName: '' # Redis username. username: '' # Redis password. password: '' # Redis DB. db: 0 # Redis broker DB. brokerDB: 1 # Redis backend DB. backendDB: 2 # # Redis TLS client configuration. # tls: ``` -------------------------------- ### Run Dfdaemon as Seed Peer CLI Source: https://d7y.io/docs/getting-started/installation/binaries View Dfdaemon CLI help documentation or start Dfdaemon as a Seed Peer. ```bash # View Dfdaemon cli help docs. dfdaemon --help # Setup Dfdaemon, it is recommended to start Dfdaemon via systemd. dfdaemon ``` -------------------------------- ### Git LFS Download Log Example Source: https://d7y.io/docs/operations/integrations/git-lfs An example of verbose Git LFS logs showing download actions and the content storage URL. Look for 'trace git-lfs' and details within 'actions.download.href'. ```log 18:52:51.137490 trace git-lfs: HTTP: {"objects":[{"oid":"68ac0af011ce9c51a4c74c5ac9a40218e9e67bf55ebe13c8f2d758f710a3163a","size":19670194,"actions":{"download":{"href":"https://github-cloud.githubusercontent.com/alambic/media/730487717/68/ac/68ac0af011ce9c51a4c74c5ac9a40218e9e67bf55ebe13c8f2d758f710a3163a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA5BA2674WPWWEFGQ5%2F20240605%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240605T105251Z&X-Amz-Expires=3600&X-Amz-Signature=35cf8e02f0d3e2da893aa46fa4929d79ce1abb18aea8e0fabfbb138706d7151818:52:51.137574 trace git-lfs: HTTP: &X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=810214636&token=1"}}}]} ``` -------------------------------- ### Manage dfdaemon Service with Systemd Source: https://d7y.io/docs/getting-started/installation/binaries Commands to enable, start, and check the status of the dfdaemon service using systemd. Ensure the manager and scheduler are running before starting dfdaemon. ```bash $ sudo systemctl enable dfdaemon $ sudo systemctl start dfdaemon $ sudo systemctl status dfdaemon ``` -------------------------------- ### Install Prometheus and Grafana Stack Source: https://d7y.io/docs/operations/best-practices/observability/monitoring Installs the kube-prometheus-stack Helm chart, which includes Prometheus and Grafana, into a specified namespace. It uses a custom values file for configuration. ```bash $ helm install --create-namespace --namespace prometheus prometheus prometheus-community/kube-prometheus-stack -f https://raw.githubusercontent.com/dragonflyoss/monitoring/main/prometheus/values.yaml ``` -------------------------------- ### Example Triton Model Configuration with Dragonfly Agent Source: https://d7y.io/docs/operations/integrations/triton-server An example of a `config.pbtxt` file for a model, including the Dragonfly agent integration. This configuration specifies model details and enables Dragonfly for repository access. ```protobuf name: "densenet_onnx" platform: "onnxruntime_onnx" max_batch_size : 0 input [ { name: "data_0" data_type: TYPE_FP32 format: FORMAT_NCHW dims: [ 3, 224, 224 ] reshape { shape: [ 1, 3, 224, 224 ] } } ] output [ { name: "fc6_1" data_type: TYPE_FP32 dims: [ 1000 ] reshape { shape: [ 1, 1000, 1, 1 ] } label_filename: "densenet_labels.txt" } ] model_repository_agents { agents [ { name: "dragonfly", } ] } ``` -------------------------------- ### Run Dfdaemon with Systemd Source: https://d7y.io/docs/getting-started/installation/binaries Enable and start the dfdaemon service using systemctl. This assumes the dfdaemon executable and configuration are in place. The service status can be checked afterwards. ```bash $ sudo systemctl enable dfdaemon $ sudo systemctl start dfdaemon $ sudo systemctl status dfdaemon ● dfdaemon.service - dfdaemon is a high performance P2P download daemon Loaded: loaded (/lib/systemd/system/dfdaemon.service; enabled; preset: enabled) Active: active (running) since Mon 2024-08-05 17:46:39 UTC; 4s ago Docs: https://github.com/dragonflyoss/client Main PID: 2118 (dfdaemon) Tasks: 13 (limit: 11017) Memory: 15.0M (max: 8.0G available: 7.9G) CPU: 83ms CGroup: /system.slice/dfdaemon.service └─2118 /usr/bin/dfdaemon --config /etc/dragonfly/dfdaemon.yaml --console ``` -------------------------------- ### Download File with dfget Source: https://d7y.io/docs/concepts/task Use dfget to download files from a specified URL. Ensure the dfget utility is installed and accessible. ```bash $ dfget https://:/ -O /tmp/file.txt [00:00:00] [============================================================] 100% (209.63 KiB/s, 0.0s) ``` -------------------------------- ### Extract and Install Nydus Snapshotter Source: https://d7y.io/docs/operations/integrations/container-runtime/nydus Extract the downloaded Nydus Snapshotter archive and install the `containerd-nydus-grpc` executable to `/usr/local/bin/`. ```bash tar zxvf nydus-snapshotter_linux_arm64.tar.gz # Install executable file to /usr/local/bin/{containerd-nydus-grpc}. sudo cp bin/containerd-nydus-grpc /usr/local/bin/ ``` -------------------------------- ### Run Unit Tests Source: https://d7y.io/docs/development-guide/running-tests Execute all unit tests in the project. Ensure Golang and Rust are installed and meet the version requirements. ```bash make test ``` -------------------------------- ### Download and Install Dragonfly Client DEB Package Source: https://d7y.io/docs/getting-started/installation/binaries Download the Dragonfly client DEB package using wget and install it using dpkg. Replace `{arch}` with your system's architecture (e.g., x86_64, aarch64) and `{version}` with the desired client version. ```bash wget -O dragonfly-client-{arch}-unknown-linux-musl.deb \ https://github.com/dragonflyoss/client/releases/download/v{version}/dragonfly-client-v{version}-{arch}-unknown-linux-musl.deb dpkg -i dragonfly-client-{arch}-unknown-linux-musl.deb ``` -------------------------------- ### Start TorchServe with Dragonfly Endpoint Plugin Source: https://d7y.io/docs/operations/integrations/torchserve Start TorchServe, specifying the model store and plugins path. Ensure the plugins-path points to the directory containing the Dragonfly Endpoint JAR file. ```bash torchserve --start --model-store --plugins-path= ``` -------------------------------- ### List All Tasks Source: https://d7y.io/docs/reference/commands/client/dfctl Lists all tasks currently stored in the client's local storage. Use this command to get an overview of available tasks. ```bash dfctl task ls ``` -------------------------------- ### Dfdaemon Peer Configuration Source: https://d7y.io/docs/getting-started/installation/binaries Example configuration for setting up dfdaemon as a regular peer. This configuration only requires the manager address. ```yaml # Peer configuration. manager: addr: http://dragonfly-manager:65003 ``` -------------------------------- ### Install Dragonfly using Helm Source: https://d7y.io/docs/getting-started/quick-start/kubernetes Add the Dragonfly Helm repository and install the Dragonfly cluster using the specified configuration file. The '--wait' flag ensures the command waits for the deployment to complete. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --wait --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f charts-config.yaml ``` -------------------------------- ### Install Dragonfly using Helm Source: https://d7y.io/docs/getting-started/installation/helm-charts Add the Dragonfly Helm repository and install the Dragonfly cluster using the `values.yaml` configuration file. The `--wait` flag ensures the command waits for resources to be ready. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --wait --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f values.yaml ``` -------------------------------- ### Install Dragonfly Client using RPM Source: https://d7y.io/docs/getting-started/installation/binaries Download the Dragonfly client RPM package and install it using the 'rpm -ivh' command. Ensure to replace '{arch}' with the correct architecture (e.g., x86_64) and '{version}' with the desired version. ```bash wget -O dragonfly-client-{arch}-unknown-linux-musl.rpm https://github.com/dragonflyoss/client/releases/download/v{version}/dragonfly-client-v{version}-{arch}-unknown-linux-musl.rpm rpm -ivh dragonfly-client-{arch}-unknown-linux-musl.rpm ``` -------------------------------- ### Dragonfly download log output example Source: https://d7y.io/docs/operations/integrations/pip This is an example of the log output from a Dragonfly client pod, indicating a successful download task. It includes timestamps, host IDs, and task IDs. ```json { 2025-01-23T05:39:15.828741839+00:00 INFO download_task: dragonfly-client/src/grpc/dfdaemon_upload.rs:395: download task succeeded host_id="10.244.2.15-dragonfly-seed-client-2-seed" task_id="92d8d9e20c608edcca38790dfc76b99746e65592321923b552afe6337b275257" peer_id="10.244.2.15-dragonfly-seed-client-2-01f2e222-f517-47d8-98b4-18540e4c5be5-seed" } { 2025-01-23T05:39:18.955058382+00:00 INFO download_task: dragonfly-client/src/grpc/dfdaemon_upload.rs:395: download task succeeded host_id="10.244.2.15-dragonfly-seed-client-2-seed" task_id="7f684c300a629072a61536344a0369df2e049829ab8ab703e6de145cef18eb14" peer_id="10.244.2.15-dragonfly-seed-client-2-0f27a38b-97af-45c7-9e57-43cbc2bcd8d9-seed" } ``` -------------------------------- ### Install Dragonfly Cluster with Helm Source: https://d7y.io/docs/operations/integrations/container-runtime/nydus Commands to add the Dragonfly Helm repository and install a Dragonfly cluster using a custom configuration file. Includes options for waiting for deployment and creating namespaces. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --wait --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f charts-config.yaml ``` -------------------------------- ### Triton Inference Server Image Client Example Source: https://d7y.io/docs/operations/integrations/triton-server Use this Docker command to run the Triton image client and perform inference on an image. This verifies the inference API is responding correctly. ```bash docker run -it --rm --net=host nvcr.io/nvidia/tritonserver:23.08-py3-sdk /workspace/install/bin/image_client -m densenet_onnx -c 3 -s INCEPTION /workspace/images/mug.jpg ``` -------------------------------- ### Containerd Helm Chart Configuration Source: https://d7y.io/docs/operations/integrations/container-runtime/containerd Example values.yaml for deploying containerd via Helm charts, specifying image repositories, metrics enablement, and private registry configurations. ```yaml manager: image: repository: dragonflyoss/manager tag: latest metrics: enable: true scheduler: image: repository: dragonflyoss/scheduler tag: latest metrics: enable: true seedClient: image: repository: dragonflyoss/client tag: latest metrics: enable: true client: image: repository: dragonflyoss/client tag: latest metrics: enable: true dfinit: enable: true image: repository: dragonflyoss/dfinit tag: latest config: containerRuntime: containerd: configPath: /etc/containerd/config.toml registries: - hostNamespace: your_private_registry_host_addr serverAddr: your_private_registry_server_addr capabilities: ['pull', 'resolve'] ``` -------------------------------- ### Use Dfget to Download Files Source: https://d7y.io/docs/getting-started/installation/binaries Demonstrates how to use the dfget command-line tool to download files. Includes viewing help documentation and downloading a file via HTTP protocol. ```bash # View Dfget cli help docs. dfget --help # Download with HTTP protocol dfget -O /path/to/output http://example.com/object ``` -------------------------------- ### Create and Prepare Model Store Directory Source: https://d7y.io/docs/operations/integrations/torchserve Create a directory to store model files and set appropriate permissions for it. ```bash mkdir model-store chmod 777 model-store ``` -------------------------------- ### Enable and Start Nydus Snapshotter Service Source: https://d7y.io/docs/operations/integrations/container-runtime/nydus Commands to enable the Nydus snapshotter service to start on boot, start the service immediately, and check its status. ```bash $ sudo systemctl enable nydus-snapshotter $ sudo systemctl start nydus-snapshotter $ sudo systemctl status nydus-snapshotter ``` -------------------------------- ### Verify Dragonfly Binaries Availability Source: https://d7y.io/docs/getting-started/installation/helm-charts Execute `kubectl exec` to enter the pod and use the `which` command to confirm that the Dragonfly binaries (dfget, dfcache, dfstore, dfdaemon) are installed and accessible within the container's PATH. ```bash $ kubectl exec -it test-pod -- bash $ which dfget dfcache dfstore dfdaemon ``` -------------------------------- ### View Dfget Help and Download Files Source: https://d7y.io/docs/getting-started/installation/binaries View the help documentation for the dfget command and use it to download files via HTTP. Specify the output path with `-O`. ```bash # View Dfget cli help docs. dfget --help # Download with HTTP protocol dfget -O /path/to/output http://example.com/object ``` -------------------------------- ### Install Dragonfly using Helm Source: https://d7y.io/docs/reference/commands/client/dfcache Install Dragonfly components into a Kubernetes cluster using Helm. This command adds the Dragonfly Helm repository and installs the Dragonfly chart. ```bash helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ ``` ```bash helm install --create-namespace -n dragonfly-system dragonfly dragonfly/dragonfly ``` -------------------------------- ### Install cert-manager Source: https://d7y.io/docs/getting-started/installation/helm-charts Install cert-manager, a prerequisite for the Dragonfly webhook injector, using its official manifest. ```bash kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml ``` -------------------------------- ### Download a Single File with Authentication Source: https://d7y.io/docs/operations/integrations/model-scope To access private repositories or increase rate limits, use the --ms-token flag with your authentication token. ```bash dfget modelscope://deepseek-ai/DeepSeek-R1/config.json -O /tmp/config.json --ms-token= ``` -------------------------------- ### Install TorchServe Dependencies and Model Archiver Source: https://d7y.io/docs/operations/integrations/torchserve Install necessary Python dependencies and the TorchServe model archiver using pip and conda. ```bash python ./ts_scripts/install_dependencies.py ``` ```bash conda install torchserve torch-model-archiver torch-workflow-archiver -c pytorch ``` -------------------------------- ### Extract and Install Nydus Image Service Source: https://d7y.io/docs/operations/integrations/container-runtime/nydus Extract the Nydus Image Service archive and install the `nydus-image`, `nydusd`, and `nydusify` executables to `/usr/local/bin/`. ```bash tar zxvf nydus-image-service-linux-arm64.tgz # Install executable file to /usr/local/bin/{nydus-image,nydusd,nydusify}. sudo cp nydus-static/nydus-image nydus-static/nydusd nydus-static/nydusify /usr/local/bin/ ``` -------------------------------- ### Dfget Basic Usage Source: https://d7y.io/docs/reference/commands/client/dfget Shows the basic syntax for using dfget to download files. The output path and URL are required parameters. ```bash dfget -O ``` ```bash dfget [command] ``` -------------------------------- ### Get Task Status by Job ID Source: https://d7y.io/docs/advanced-guides/open-api/task Retrieves the status of a previously created task using its job ID. This GET request is used for polling. ```APIDOC ## GET /oapi/v1/jobs/{job_id} ### Description Polls the status of a specific job using its unique identifier. ### Method GET ### Endpoint http://dragonfly-manager:8080/oapi/v1/jobs/{job_id} ### Parameters #### Path Parameters - **job_id** (integer) - Required - The ID of the job to retrieve the status for. ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the job. - **created_at** (string) - Timestamp when the job was created. - **updated_at** (string) - Timestamp when the job was last updated. - **type** (string) - The type of task. - **state** (string) - The current state of the task (e.g., "SUCCESS"). - **args** (object) - Arguments used for the task. - **result** (object) - The result of the task execution, if available. - **job_states** (array) - An array containing job state details. - **results** (array) - An array of results, which may include peer addresses. - **peers** (array) - A list of peer addresses if the task was successful. - **state** (string) - The overall state of the result. - **updated_at** (string) - Timestamp when the result was last updated. - **scheduler_clusters** (array) - List of scheduler clusters associated with the job. #### Response Example ```json { "id": 1, "created_at": "2024-11-19T08:08:23Z", "updated_at": "2024-11-19T08:08:53Z", "type": "get_task", "state": "SUCCESS", "args": { "content_for_calculating_task_id": "your_content_for_calculating_task_id" }, "result": { "job_states": [ { "results": [ { "peers": [ { "created_at": "2024-11-19T08:13:35.210473555Z", "host_type": "super", "hostname": "dragonfly-seed-client-0", "id": "10.244.1.32-dragonfly-seed-client-0-9783271e-e27c-4b16-a7c9-6a8ffe18cd1a-seed", "ip": "10.244.1.32", "updated_at": "2024-11-19T08:13:35.364939639Z" } ], "scheduler_cluster_id": 1 } ], "state": "SUCCESS" } ], "state": "SUCCESS", "updated_at": "2024-11-19T08:08:53.157878758Z" }, "scheduler_clusters": [ { "id": 1, "created_at": "2024-11-15T08:06:37Z", "updated_at": "2024-11-15T08:06:37Z", "name": "cluster-1" } ] } ``` ``` -------------------------------- ### Download and Enable Stargz Systemd Service Source: https://d7y.io/docs/operations/integrations/container-runtime/stargz Download the stargz-snapshotter systemd service file and enable/start the service. ```bash wget -O /etc/systemd/system/stargz-snapshotter.service https://raw.githubusercontent.com/containerd/stargz-snapshotter/main/script/config/etc/systemd/system/stargz-snapshotter.service systemctl enable --now stargz-snapshotter systemctl restart containerd ``` -------------------------------- ### Dragonfly Preheat Job Status Example (Pending) Source: https://d7y.io/docs/getting-started/quick-start/kubernetes This JSON shows an example of a preheat job status where the state is 'PENDING'. A 'SUCCESS' state indicates the preheating is complete. ```json { "id": 1, "created_at": "2024-04-18T08:51:55Z", "updated_at": "2024-04-18T08:51:55Z", "task_id": "group_2717f455-ff0a-435f-a3a7-672828d15a2a", "type": "preheat", "state": "PENDING", "args": { "filteredQueryParams": "Expires&Signature", "headers": null, "password": "", "pieceLength": 4194304, "platform": "", "tag": "", "type": "image", "url": "https://index.docker.io/v2/library/alpine/manifests/3.19", "username": "" }, "scheduler_clusters": [ { "id": 1, "created_at": "2024-04-18T08:29:15Z", "updated_at": "2024-04-18T08:29:15Z", "name": "cluster-1" } ] } ``` -------------------------------- ### Run Scheduler Source: https://d7y.io/docs/development-guide/configure-development-environment Execute the Scheduler component using 'go run'. Provide the configuration file path and enable console output. ```bash # Setup Scheduler. go run cmd/scheduler/main.go --config /etc/dragonfly/scheduler.yaml --console ``` -------------------------------- ### Request Trait Definition Source: https://d7y.io/docs/advanced-guides/request-sdk Defines the interface for sending GET requests via the Dragonfly SDK. Use `get` for streaming responses and `get_into` to write directly into a buffer. ```rust /// Defines the interface for sending requests via the Dragonfly. /// /// This trait enables interaction with remote servers through the Dragonfly, providing methods /// for performing GET requests with flexible response handling. It is designed for clients that /// need to communicate with Dragonfly seed client efficiently, supporting both streaming and buffered /// response processing. The trait shields the complex request logic between the client and the /// Dragonfly seed client's proxy, abstracting the underlying communication details to simplify /// client implementation and usage. #[tonic::async_trait] pub trait Request { /// Sends an GET request to a remote server via the Dragonfly and returns a response /// with a streaming body. /// /// This method is designed for scenarios where the response body is expected to be processed as a /// stream, allowing efficient handling of large or continuous data. The response includes metadata /// such as status codes and headers, along with a streaming `Body` for accessing the response content. async fn get(&self, request: GetRequest) -> Result>; /// Sends an GET request to a remote server via the Dragonfly and writes the response /// body directly into the provided buffer. /// /// This method is optimized for scenarios where the response body needs to be stored directly in /// memory, avoiding the overhead of streaming for smaller or fixed-size responses. The provided /// `BytesMut` buffer is used to store the response content, and the response metadata (e.g., status /// and headers) is returned separately. async fn get_into(&self, request: GetRequest, buf: &mut BytesMut) -> Result; } ``` -------------------------------- ### Install Dragonfly Cluster A with Helm Source: https://d7y.io/docs/getting-started/quick-start/multi-cluster-kubernetes Installs Dragonfly cluster A using Helm, applying the specified configuration file. This command ensures the cluster is created and waits for deployment to complete. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --wait --create-namespace --namespace cluster-a dragonfly dragonfly/dragonfly -f charts-config-cluster-a.yaml ``` -------------------------------- ### Prepare Images for Inference Source: https://d7y.io/docs/operations/integrations/torchserve Download sample images (kitten_small.jpg and dogs-before.jpg) to be used for testing the inference API. ```bash # Prepare pictures that require reasoning. curl -O https://raw.githubusercontent.com/pytorch/serve/master/docs/images/kitten_small.jpg curl -O https://raw.githubusercontent.com/pytorch/serve/master/docs/images/dogs-before.jpg ``` -------------------------------- ### Install Dragonfly Helm Chart Source: https://d7y.io/docs/operations/integrations/triton-server Installs the Dragonfly Helm chart into a Kubernetes cluster using a specified configuration file. This command ensures the cluster is created and waits for deployment to complete. ```bash $ helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ $ helm install --wait --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly -f charts-config.yaml LAST DEPLOYED: Mon June 27 19:56:34 2024 NAMESPACE: dragonfly-system STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: 1. Get the scheduler address by running these commands: export SCHEDULER_POD_NAME=$(kubectl get pods --namespace dragonfly-system -l "app=dragonfly,release=dragonfly,component=scheduler" -o jsonpath={.items[0].metadata.name}) export SCHEDULER_CONTAINER_PORT=$(kubectl get pod --namespace dragonfly-system $SCHEDULER_POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") kubectl --namespace dragonfly-system port-forward $SCHEDULER_POD_NAME 8002:$SCHEDULER_CONTAINER_PORT echo "Visit http://127.0.0.1:8002 to use your scheduler" 2. Get the dfdaemon port by running these commands: export DFDAEMON_POD_NAME=$(kubectl get pods --namespace dragonfly-system -l "app=dragonfly,release=dragonfly,component=dfdaemon" -o jsonpath={.items[0].metadata.name}) export DFDAEMON_CONTAINER_PORT=$(kubectl get pod --namespace dragonfly-system $DFDAEMON_POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") You can use $DFDAEMON_CONTAINER_PORT as a proxy port in Node. 3. Configure runtime to use dragonfly: https://d7y.io/docs/getting-started/quick-start/kubernetes/ 4. Get Jaeger query URL by running these commands: export JAEGER_QUERY_PORT=$(kubectl --namespace dragonfly-system get services dragonfly-jaeger-query -o jsonpath="{.spec.ports[0].port}") kubectl --namespace dragonfly-system port-forward service/dragonfly-jaeger-query 16686:$JAEGER_QUERY_PORT echo "Visit http://127.0.0.1:16686/search?limit=20&lookback=1h&maxDuration&minDuration&service=dragonfly to query download events" ``` -------------------------------- ### Download Directory with OSS Source: https://d7y.io/docs/reference/commands/client/dfget Recursively download an entire directory from an Alibaba Cloud Object Storage Service (OSS) bucket. Authentication credentials and the OSS endpoint are required. ```bash # Download a directory. dfget oss:/// -O /tmp/path/ --recursive --storage-access-key-id= --storage-access-key-secret= --storage-endpoint= ``` -------------------------------- ### Run Manager Source: https://d7y.io/docs/development-guide/configure-development-environment Execute the Manager component using 'go run'. Specify the configuration file path and enable console output. ```bash # Setup Manager. go run cmd/manager/main.go --config /etc/dragonfly/manager.yaml --console ``` -------------------------------- ### Apply Dragonfly Service Configuration Source: https://d7y.io/docs/operations/integrations/torchserve Apply the `dfstore.yaml` configuration to create the Kubernetes Service, making the Dragonfly Peer's HTTP proxy accessible. ```bash kubectl --namespace dragonfly-system apply -f dfstore.yaml ``` -------------------------------- ### Download Directory with OBS Source: https://d7y.io/docs/reference/commands/client/dfget Recursively download an entire directory from Huawei Cloud Object Storage Service (OBS). Authentication credentials and the OBS endpoint are required. ```bash # Download a directory. dfget obs:/// -O /tmp/path/ --recursive --storage-access-key-id= --storage-access-key-secret= --storage-endpoint= ``` -------------------------------- ### Download Entire Hugging Face Repository Source: https://d7y.io/docs/reference/commands/client/dfget Recursively download an entire repository from Hugging Face. You can specify a revision, defaulting to 'main'. ```bash # Download an entire repository. dfget hf:/// -O /tmp/repo/ --recursive # Download an entire repository from Hugging Face Hub with specified revision. If the revision is not specified, the default value is `main`. $ dfget hf:/// --hf-revision main -O /tmp/repo/ -r ``` -------------------------------- ### Download Verification Model Source: https://d7y.io/docs/operations/integrations/torchserve Download a sample model (squeezenet1_1_scripted.mar) from the TorchServe Model Zoo for verification purposes. ```bash wget https://torchserve.pytorch.org/mar_files/squeezenet1_1_scripted.mar ``` -------------------------------- ### Wait for cert-manager to be ready Source: https://d7y.io/docs/getting-started/installation/helm-charts Ensure cert-manager is fully available before proceeding with Dragonfly installation. ```bash kubectl wait --for=condition=Available deployment --all -n cert-manager --timeout=300s ``` -------------------------------- ### Configure Peer HTTP Proxy with Basic Authentication Source: https://d7y.io/docs/operations/best-practices/security Configure `dfdaemon.yaml` to use Basic Authentication for the peer's HTTP proxy. Note that Basic Auth is not the most secure method and should be used with caution. ```yaml proxy: # basic_auth is the basic auth configuration for HTTP proxy in dfdaemon. If basic_auth is not # empty, the proxy will use the basic auth to authenticate the client by Authorization # header. The value of the Authorization header is "Basic base64(username:password)", refer # to https://en.wikipedia.org/wiki/Basic_access_authentication. basicAuth: # username is the username for basic auth. username: 'admin' # password is the password for basic auth. password: 'dragonfly' ``` -------------------------------- ### TorchServe Worker Update Response Source: https://d7y.io/docs/operations/integrations/torchserve This is the expected response when updating model workers, indicating that the processing has started. ```json { "status": "Processing worker updates..." } ``` -------------------------------- ### Preheat Task Status Example Source: https://d7y.io/docs/advanced-guides/open-api/preheat This JSON object represents the status of a preheating task, indicating success. ```json { "id": 1, "created_at": "2024-12-11T08:30:12Z", "updated_at": "2024-12-11T08:30:51Z", "task_id": "group_4dd1da54-96ca-48ff-8f20-4fae665f677f", "bio": "", "type": "preheat", "state": "SUCCESS", "args": { "platform": "", "scope": "single_seed_peer", "type": "file", "url": "https://example.com" }, "scheduler_clusters": [ { "id": 1, "created_at": "2024-12-11T07:57:44Z", "updated_at": "2024-12-11T07:57:44Z", "name": "cluster-1" } ] } ``` -------------------------------- ### Create Kind Multi-Node Cluster Source: https://d7y.io/docs/getting-started/quick-start/kubernetes Use the 'kind create cluster' command with the specified configuration file to set up a local Kubernetes cluster for testing. ```bash kind create cluster --config kind-config.yaml ``` -------------------------------- ### Verify Seed Peer Ports Source: https://d7y.io/docs/getting-started/installation/binaries Verify if the Seed Peer is started and if ports 4000, 4001, and 4002 are available. ```bash telnet 127.0.0.1 4000 telnet 127.0.0.1 4001 telnet 127.0.0.1 4002 ``` -------------------------------- ### Create Plugins Path Directory Source: https://d7y.io/docs/operations/integrations/torchserve Create a directory to store the binaries of the Dragonfly Endpoint plugin. ```bash mkdir plugins-path ``` -------------------------------- ### Download a Single File with Authentication Source: https://d7y.io/docs/operations/integrations/hugging-face For private repositories or to increase rate limits, provide your Hugging Face token using the --hf-token flag. Ensure the token is kept secure. ```bash dfget hf://meta-llama/Llama-2-7b/config.json -O /tmp/config.json --hf-token= ``` -------------------------------- ### Scheduler CLI Usage Source: https://d7y.io/docs/reference/commands/scheduler Basic usage patterns for the scheduler command-line interface. Use this to start the scheduler or access its subcommands. ```bash scheduler [flags] scheduler [command] ``` -------------------------------- ### Extract Dragonfly Binaries Source: https://d7y.io/docs/getting-started/installation/binaries Extract the downloaded Dragonfly binaries to the specified installation directory. Replace '/path/to/dragonfly' with your target path. ```bash # Replace `/path/to/dragonfly` with the installation directory. tar -zxf dragonfly_linux_amd64.tar.gz -C /path/to/dragonfly ``` -------------------------------- ### Download Sample Images for Inference Source: https://d7y.io/docs/operations/integrations/torchserve Download sample images to be used for testing the inference API. ```bash # Prepare pictures that require reasoning. curl -O https://raw.githubusercontent.com/pytorch/serve/master/docs/images/kitten_small.jpg curl -O https://raw.githubusercontent.com/pytorch/serve/master/docs/images/dogs-before.jpg ``` -------------------------------- ### Call Inference API Source: https://d7y.io/docs/operations/integrations/torchserve Send a request to the TorchServe inference API with the prepared images to get predictions from the 'squeezenet1_1' model. ```bash # Call inference API. curl http://localhost:8080/predictions/squeezenet1_1 -T kitten_small.jpg -T dogs-before.jpg ``` -------------------------------- ### Download Repository Snapshot with Dragonfly Source: https://d7y.io/docs/operations/integrations/hugging-face Use this script to download a snapshot of a repository using Dragonfly. Ensure you have Python 3 installed. ```bash $ python3 snapshot_download_dragonfly.py ``` -------------------------------- ### Create and Set Permissions for Model Store Source: https://d7y.io/docs/operations/integrations/torchserve Create a directory to store models and set its permissions to 777. ```bash mkdir model-store ``` ```bash chmod 777 model-store ``` -------------------------------- ### Call TorchServe Inference API Source: https://d7y.io/docs/operations/integrations/torchserve Send requests to the TorchServe inference API with the prepared images. This example uses the squeezenet1_1 model. ```bash # Call inference API. curl http://localhost:8080/predictions/squeezenet1_1 -T kitten_small.jpg -T dogs-before.jpg ``` -------------------------------- ### Download File with OSS Source: https://d7y.io/docs/reference/commands/client/dfget Download a single file from an Alibaba Cloud Object Storage Service (OSS) bucket. Authentication credentials and the OSS endpoint are required. ```bash # Download a file. dfget oss:/// -O /tmp/file.txt --storage-access-key-id= --storage-access-key-secret= --storage-endpoint= ```