functions
latest
false
Functions ユーザー ガイド
- 概要
- Python の関数
- デプロイして実行する
@traced デコレーターを使用すると、個々の実行ステップをジョブのトレースや Maestro ダッシュボードで確認できます。これを使用して、意味のある作業を行うヘルパー関数に注釈を付け、どこに時間が費やされ、どこで実行が失敗したかを確認できます。
from uipath.tracing import traced
@traced(name="fetch_document", run_type="uipath")
def fetch_document(document_id: str) -> bytes:
# implementation
...
def main(input: Input) -> Output: # do not trace the entry point
content = fetch_document(input.document_id)
return Output(result_id="123")
from uipath.tracing import traced
@traced(name="fetch_document", run_type="uipath")
def fetch_document(document_id: str) -> bytes:
# implementation
...
def main(input: Input) -> Output: # do not trace the entry point
content = fetch_document(input.document_id)
return Output(result_id="123")
重要:
エントリ ポイント関数には @traced 適用しないでください。ランタイムはすでにジョブ全体を独自のスパン内にラップしています。エントリ ポイントをトレースすると、重複する入れ子になったスパンが生成されます。
キャプチャ対象
トレースされる各ステップには、その名前、実行の種類、開始時刻と終了時刻、ステータスが記録されます。トレースは Orchestrator のジョブにリンクされているため、Maestro プロセス インスタンスから実行された個々の関数のステップまで移動できます。
ガイダンス
- 個別の作業単位 (外部呼び出し、抽出、変換) を表すステップをトレースします。
- ステップごとに明確で安定した
name使用するため、実行全体にわたってトレースが読みやすいようにします。 - プラットフォームのステップについては、常に
run_type="uipath"してください。
次のステップ
- 関数を呼び出し — 「Maestro プロセスのトレース」をご覧ください。