我在反洗钱中用一个独特的步骤做了一个最小的Pipeline。我已经发布了这个管道,并为它发布了、id和REST endpoint。
当我试图在这个管道上创建一个计划时,我没有发现任何错误,但是它永远不会启动。
from azureml.core.runconfig import RunConfiguration
from azureml.pipeline.steps import PythonScriptStep
from azureml.pipeline.core import Pipeline
datastore = ws.get_default_datastore()
minimal_run_config = RunConfiguration()
minimal_run_config.environment = myenv # Custom Env with Dockerfile from mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest + openSDK 11 + pip/conda packages
step_name = experiment_name
script_step_1 = PythonScriptStep(
name=step_name,
script_name="main.py",
arguments=args,
compute_target=cpu_cluster,
source_directory=str(source_path),
runconfig=minimal_run_config,
)
pipeline = Pipeline(
workspace=ws,
steps=[
script_step_1,
],
)
pipeline.validate()
pipeline.publish(name=experiment_name + "_pipeline")我可以用REST python触发这个管道。
from azureml.core.authentication import InteractiveLoginAuthentication
from azureml.pipeline.core import PublishedPipeline
import requests
auth = InteractiveLoginAuthentication()
aad_token = auth.get_authentication_header()
pipelines = PublishedPipeline.list(ws)
rest_endpoint1 = [p for p in pipelines if p.name == experiment_name + "_pipeline"][0]
response = requests.post(rest_endpoint1.endpoint,
headers=aad_token,
json={"ExperimentName": experiment_name,
"RunSource": "SDK",
"ParameterAssignments": {"KEY": "value"}})但是当我使用这个计划时,我没有任何警告,没有错误,如果我使用来自start_time的ScheduleRecurrence,什么都不会触发。如果我不使用start_time,我的管道就会被触发并立即启动。我不想要这个。例如,我正在运行时间表设置程序today,但我希望它的第一个触发器在每个月的下午4时只运行第二个触发器
from azureml.pipeline.core.schedule import ScheduleRecurrence, Schedule
import datetime
first_run = datetime.datetime(2022, 10, 2, 16, 00)
schedule_name = f"Recocpc monthly run PP {first_run.day:02} {first_run.hour:02}:{first_run.minute:02}"
recurrence = ScheduleRecurrence(
frequency="Month",
interval=1,
start_time=first_run,
)
recurrence.validate()
recurring_schedule = Schedule.create_for_pipeline_endpoint(
ws,
name=schedule_name,
description="Recocpc monthly run PP",
pipeline_endpoint_id=pipeline_endpoint.id,
experiment_name=experiment_name,
recurrence=recurrence,
pipeline_parameters={"KEY": "value"}
)如果我评论start_time,它就会工作,但是第一次运行是现在,而不是我想要的时候。
发布于 2022-10-14 12:55:48
所以我不知道start_time是如何工作的。它使用DAGs逻辑,就像在气流中一样。
下面是一个示例:
今天是10-01-2022 (dd-mm-yyy)
你希望你的管道每个月运行一次,在每个月的十号14:00。
那么您的start_time不是2022-01-10T14:00:00,而应该是2021-12-10T14:00:00。
您的调度程序只有在您所要求的内容发生了彻底的革命时才会触发(这里是一个月)。
也许官方文件应该更明确地说明这种机制,因为像我这样的新手在他们的生活中从来没有使用过DAG。
https://stackoverflow.com/questions/73933808
复制相似问题