監視エージェントのインストールと設定¶
実行中のエージェントは、設定されたディレクトリまたはメッセージキューイングシステムでバッファリングされたメッセージを探して転送します。 バッファリングされたメッセージをMLOpsライブラリからDataRobot MLOpsに転送するには、以下に示すように監視エージェントをインストールして設定します。
-
MLOps.tarファイルの解凍。
tar -xvf datarobot_mlops_package-*.tar.gz
-
設定ファイルの更新。
cd datarobot_mlops_package-*; <your-favorite-editor> ./conf/mlops.agent.conf.yaml
-
監視エージェントを設定。
エージェント設定ファイル(
conf\mlops.agent.conf.yaml
)で、mlopsUrl
およびapiToken
の値を更新する必要があります。 デフォルトでは、エージェントはfilesystem
のチャネルを使用します。filesystem
のチャネルを使用する場合は、必ずスプーラーディレクトリ(デフォルトでは/tmp/ta
)を作成してください。重要
filesystem
スプーラーチャネルの場合、指定するdirectory
パスは、エージェントが/tmp/ta
ディレクトリ(または作成したカスタムディレクトリ)にアクセスするための絶対パス(完全なディレクトリリストを含む)である必要があります。別のチャネルを使用する場合は、エージェント設定ファイルのコメントに従ってパスを更新してください。
mlops.agent.conf.yaml# This file contains configuration for the MLOps agent # URL to the DataRobot MLOps service mlopsUrl: "https://<MLOPS_HOST>" # DataRobot API token apiToken: "<MLOPS_API_TOKEN>" # Execute the agent once, then exit runOnce: false # When dryrun mode is true, do not report the metrics to MLOps service dryRun: false # When verifySSL is true, SSL certification validation will be performed when # connecting to MLOps DataRobot. When verifySSL is false, these checks are skipped. # Note: It is highly recommended to keep this config variable as true. verifySSL: true # Path to write agent stats statsPath: "/tmp/tracking-agent-stats.json" # Prediction Environment served by this agent. # Events and errors not specific to a single deployment are reported against this Prediction Environment. # predictionEnvironmentId: "<PE_ID_FROM_DATAROBOT_UI>" # Number of times the agent will retry sending a request to the MLOps service on failure. httpRetry: 3 # Http client timeout in milliseconds (30sec timeout) httpTimeout: 30000 # Number of concurrent http request, default=1 -> synchronous mode; > 1 -> asynchronous httpConcurrentRequest: 10 # Number of HTTP Connections to establish with the MLOps service, Default: 1 numMLOpsConnections: 1 # Comment out and configure the lines below for the spooler type(s) you are using. # Note: The spooler configuration must match that used by the MLOps library. # Note: The filesystem spooler directory must be an absolute path to the "/tmp/ta" directory. # Note: Spoolers must be set up before using them. # - For the filesystem spooler, create the directory that will be used. # - For the SQS spooler, create the queue. # - For the PubSub spooler, create the project and topic. # - For the Kafka spooler, create the topic. channelConfigs: - type: "FS_SPOOL" details: {name: "filesystem", directory: "<path_to_spooler_directory>/tmp/ta"} # - type: "SQS_SPOOL" # details: {name: "sqs", queueUrl: "your SQS queue URL", queueName: "<your AWS SQS queue name>"} # - type: "RABBITMQ_SPOOL" # details: {name: "rabbit", queueName: <your rabbitmq queue name>, queueUrl: "amqp://<ip address>", # caCertificatePath: "<path_to_ca_certificate>", # certificatePath: "<path_to_client_certificate>", # keyfilePath: "<path_to_key_file>"} # - type: "PUBSUB_SPOOL" # details: {name: "pubsub", projectId: <your project ID>, topicName: <your topic name>, subscriptionName: <your sub name>} # - type: "KAFKA_SPOOL" # details: {name: "kafka", topicName: "<your topic name>", bootstrapServers: "<ip address 1>,<ip address 2>,…"} # The number of threads that the agent will launch to process data records. agentThreadPoolSize: 4 # The maximum number of records each thread will process per fetchNewDataFreq interval. agentMaxRecordsTask: 100 # Maximum number of records to aggregate before sending to DataRobot MLOps agentMaxAggregatedRecords: 500 # A timeout for pending records before aggregating and submitting agentPendingRecordsTimeoutMs: 5000
-
監視エージェントをDockerでネイティブに実行するには、まずMLOpsエージェントのtarballから
datarobot/mlops-tracking-agent
のイメージをビルドします。make build -C tools/agent_docker
-
デフォルトディレクトリまたはカスタムロケーションにマウントされた監視エージェントをDockerで設定します。
-
デフォルトディレクトリにマウントされた設定で監視エージェントを実行するには:
docker run \ -v /path/to/mlops.agent.conf.yaml:/opt/datarobot/mlops/agent/conf/mlops.agent.conf.yaml \ datarobot/mlops-tracking-agent
-
カスタムの場所にマウントされた設定で監視エージェントを実行するには:
docker run \ -v /path/to/mlops.agent.conf.yaml:/var/tmp/mlops.agent.conf.yaml \ -e MLOPS_AGENT_CONFIG_YAML=/var/tmp/mlops.agent.conf.yaml \ datarobot/mlops-tracking-agent
-
監視エージェントの使用¶
監視エージェントを設定したら、エージェントの実行、エージェントのステータス確認、エージェントのシャットダウンを実行できます。
監視エージェントの実行¶
設定ファイルを使用してエージェントを起動します。
cd datarobot_mlops_package-*;
./bin/start-agent.sh
または、環境変数を使用してエージェントを起動します。
export AGENT_CONFIG_YAML=<path/to/conf/mlops.agent.conf.yaml>
export AGENT_LOG_PROPERTIES=<path/to/conf/mlops.log4j2.properties>
export AGENT_JVM_OPT=-Xmx4G
export AGENT_JAR_PATH=<path/to/bin/mlops-agent-ver.jar>
./bin/start-agent.sh
使用可能な環境変数の完全なリファレンスについては、MLOpsエージェント環境変数を参照してください。
エージェントのステータス確認¶
エージェントのステータスを確認するには:
./bin/status-agent.sh
./bin/status-agent.sh --verbose
エージェントをシャットダウン¶
エージェントをシャットダウンするには:
./bin/stop-agent.sh