Dave
01/07/2022, 2:21 PMDave
01/07/2022, 2:21 PMAnna Geller
AttributeError: 'V1Job' object has no attribute 'name'
Prefect can deploy a namespaced job if the kind of job is a plain Kubernetes job, it cannot deploy kind V1Job. Can you share your flow definition that generated this log and the job spec to check it?Dave
01/07/2022, 2:40 PMimport requests
import pendulum
from prefect import Flow, task
from prefect.storage.docker import Docker
from prefect.schedules import Schedule, clocks
@task
def fetch():
r = requests.get('<http://google.com>')
if not r.ok:
raise Exception(r.text)
return r.text
schedule = Schedule(clocks=[clocks.CronClock("0/5 * * * *", pendulum.parse('2022-01-07T00:00'))])
with Flow("test_google", schedule) as flow:
_ = fetch()
flow.storage = Docker(
registry_url='<url>',
image_name='<name>',
dockerfile='<Dockerfile>',
)
flow.storage.add_flow(flow)
flow.storage.build(push=True)
flow.register(project_name='<Project>', labels=['<Label>'])
Anna Geller
Dave
01/07/2022, 2:52 PMfrom os import path
from typing import List, Union
from prefect.executors import LocalExecutor
from prefect.run_configs import KubernetesRun
def get_default_run_config(
image: str = '<Image>',
labels: List[str] = ['<Label>],
job_spec_filename='job_spec_default.yaml',
env: Union[dict, None] = None
):
return KubernetesRun(
job_template_path=path+job_spec_filename,
image=image,
labels=labels,
env=env,
)
flow.run_config = get_default_run_config(env=env)
Kevin Kho
cloud.agent.kubernetes_keep_alive
in the PR you linked not work for you?Ivan Kuznetsov
01/07/2022, 3:15 PM0.15.8
to start working. Thank you!
We have enabled this setting and so far it looks very good!Dave
01/07/2022, 3:28 PMmutation {
delete_flow_run(input: {flow_run_id: "a27fe499-4287-4ebe-86d0-c38543a2577a"}) {
success
error
}
}
Kevin Kho
Anna Geller
<https://cloud.prefect.io/yourteamname/flow-run/a27fe499-4287-4ebe-86d0-c38543a2577a>
Dave
01/07/2022, 5:37 PMAnna Geller