Serdar Tumgoren
08/19/2021, 10:46 PMSerdar Tumgoren
08/19/2021, 10:48 PMSerdar Tumgoren
08/19/2021, 10:49 PMKevin Kho
Kevin Kho
Serdar Tumgoren
08/19/2021, 10:50 PMSerdar Tumgoren
08/19/2021, 10:51 PMKevin Kho
Serdar Tumgoren
08/19/2021, 10:51 PMKevin Kho
LocalRun
is a config that would replace KubernetesRun
Serdar Tumgoren
08/19/2021, 10:52 PMKevin Kho
Serdar Tumgoren
08/19/2021, 10:53 PMKevin Kho
Serdar Tumgoren
08/19/2021, 10:53 PMSerdar Tumgoren
08/19/2021, 10:54 PMKevin Kho
Kevin Kho
Serdar Tumgoren
08/19/2021, 10:55 PMKevin Kho
KubernetesRun
with LocalDaskExcutor
worked?Serdar Tumgoren
08/19/2021, 10:56 PMSerdar Tumgoren
08/19/2021, 10:56 PMKevin Kho
LocalRun
is not gonna use Kubernetes just to clarify. Just wanna see LocalRun + DaskExecutor works so we can isolate k8sSerdar Tumgoren
08/19/2021, 10:57 PMSerdar Tumgoren
08/19/2021, 10:57 PMSerdar Tumgoren
08/19/2021, 11:00 PMSerdar Tumgoren
08/19/2021, 11:00 PMOSError: Timed out trying to connect to <tcp://agenda-watch-scraping-dask-scheduler:8786> after 30 s
└── 15:59:55 | ERROR | Unexpected error occured in FlowRunner: OSError('Timed out trying to connect to <tcp://agenda-watch-scraping-dask-scheduler:8786> after 30 s')
Serdar Tumgoren
08/19/2021, 11:01 PMSerdar Tumgoren
08/19/2021, 11:01 PMKevin Kho
Serdar Tumgoren
08/19/2021, 11:33 PMtcp
address from the DaskExecutor line (which I had configured while attempting to debug in K8S). After changing to plain old flow.executor = DaskExecutor()
and fixing an import bug, the modified script works locally. Attaching latest versionKevin Kho
Serdar Tumgoren
08/19/2021, 11:39 PMSerdar Tumgoren
08/19/2021, 11:47 PMWilson Bilkovich
08/19/2021, 11:58 PMWilson Bilkovich
08/19/2021, 11:59 PMfrom prefect.executors import DaskExecutor
from dask_kubernetes import KubeCluster, make_pod_spec
pod_spec = make_pod_spec(image='daskdev/dask:latest',
memory_limit='4G', memory_request='4G',
cpu_limit=1, cpu_request=1,
env={'EXTRA_PIP_PACKAGES': 'prefect'})
executor = DaskExecutor(
cluster_class=KubeCluster,
cluster_kwargs=dict(
namespace="prefect",
pod_template=pod_spec,
n_workers=1,
)
)
Wilson Bilkovich
08/19/2021, 11:59 PMprefect
is the namespace I chose to create in advance)Wilson Bilkovich
08/20/2021, 12:01 AMn_workers
, at the moment)Serdar Tumgoren
08/20/2021, 12:03 AMWilson Bilkovich
08/20/2021, 12:03 AMSerdar Tumgoren
08/20/2021, 12:05 AMWilson Bilkovich
08/20/2021, 12:08 AMWilson Bilkovich
08/20/2021, 12:08 AMWilson Bilkovich
08/20/2021, 12:08 AMSerdar Tumgoren
08/20/2021, 12:16 AMWilson Bilkovich
08/20/2021, 12:16 AMWilson Bilkovich
08/20/2021, 12:22 AMWilson Bilkovich
08/20/2021, 12:23 AMSerdar Tumgoren
08/20/2021, 12:25 AMSerdar Tumgoren
08/20/2021, 5:20 PMprefect agent kubernetes install --rbac --namespace=default --service-account-name prefect -t MY_TOKEN | kubectl apply --namespace=default -f -
Kevin Kho
KubernetesRun
and LocalExecutor
to see if that works too?Serdar Tumgoren
08/20/2021, 5:23 PMWilson Bilkovich
08/20/2021, 5:25 PM--set agent.enabled=true
Wilson Bilkovich
08/20/2021, 5:25 PMSerdar Tumgoren
08/20/2021, 5:27 PMWilson Bilkovich
08/20/2021, 5:31 PMWilson Bilkovich
08/20/2021, 5:31 PMSerdar Tumgoren
08/20/2021, 5:32 PMKevin Kho
KubernetesRun
with no DaskExecutor
so let me know if LocalExecutor
works for you, otherwise I’ll continue and spin up a Dask clusterSerdar Tumgoren
08/20/2021, 5:33 PMKevin Kho
Serdar Tumgoren
08/20/2021, 5:35 PMKevin Kho
Serdar Tumgoren
08/20/2021, 5:46 PMKevin Kho
Serdar Tumgoren
08/20/2021, 5:47 PMprefect agent kubernetes install
command that’s piped to kubectl
?Kevin Kho
Wilson Bilkovich
08/20/2021, 5:49 PMSerdar Tumgoren
08/20/2021, 5:49 PMSerdar Tumgoren
08/20/2021, 5:49 PMWilson Bilkovich
08/20/2021, 5:50 PMWilson Bilkovich
08/20/2021, 5:50 PMWilson Bilkovich
08/20/2021, 5:51 PMWilson Bilkovich
08/20/2021, 5:52 PM% k get pods
NAME READY STATUS RESTARTS AGE
prefect-server-initial-agent-5f76b4fd69-xmdxl 1/1 Running 4 2d20h
prefect-server-initial-apollo-586cbdffb5-pbdrr 1/1 Running 1 2d20h
prefect-server-initial-create-tenant-job-hw74c 0/1 Completed 4 2d20h
prefect-server-initial-graphql-b5489bbf6-kcnzg 1/1 Running 0 2d20h
prefect-server-initial-hasura-68448b469b-jr4bz 1/1 Running 2 2d20h
prefect-server-initial-postgresql-0 1/1 Running 0 2d20h
prefect-server-initial-towel-656fdc954b-5fvjh 1/1 Running 0 2d20h
prefect-server-initial-ui-5d4f9ff55-69csx 1/1 Running 0 2d20h
Wilson Bilkovich
08/20/2021, 5:52 PM[2021-08-17 20:57:40,279] INFO - agent | Registration successful!
and [2021-08-17 20:57:40,291] INFO - agent | Waiting for flow runs...
but doesn’t seem to acquire any workKevin Kho
prefect agent kubernetes install --rbac --key XXX
but then I changed my image so here is my final yaml , just took out the key to not expose it. and then I used kubectl apply --namespace=default -f agent.yaml
where agent.yaml
is the file from the github gistKevin Kho
Wilson Bilkovich
08/20/2021, 5:57 PMWilson Bilkovich
08/20/2021, 5:57 PMKevin Kho
add_default_labels=None
), which is from the base Storage classKevin Kho
Serdar Tumgoren
08/20/2021, 6:02 PMWilson Bilkovich
08/20/2021, 6:03 PMKevin Kho
Wilson Bilkovich
08/20/2021, 6:04 PMKevin Kho
key
is a 0.15.0 thing. the auth system was changed to use keysSerdar Tumgoren
08/20/2021, 6:04 PMKevin Kho
Kevin Kho
prefect diagnostics
? @Serdar TumgorenKevin Kho
Wilson Bilkovich
08/20/2021, 6:06 PMKevin Kho
Serdar Tumgoren
08/20/2021, 6:07 PMKevin Kho
Serdar Tumgoren
08/20/2021, 6:10 PMNAME READY STATUS RESTARTS AGE
prefect-agent-6c46558df-xjxlg 1/1 Running 0 116m
Kevin Kho
kubectl delete pod --name prefect-agent-6b9b7957b7-wc6hb
. Oh yeah I just wanna make sure we hit the right agent this time (the new one)Serdar Tumgoren
08/20/2021, 6:14 PMSerdar Tumgoren
08/20/2021, 6:16 PMKevin Kho
--token
instead of --key
?Serdar Tumgoren
08/20/2021, 6:17 PMKevin Kho
Serdar Tumgoren
08/20/2021, 6:19 PMSerdar Tumgoren
08/20/2021, 6:20 PMSerdar Tumgoren
08/20/2021, 6:20 PMKevin Kho
Serdar Tumgoren
08/20/2021, 6:24 PMprefect
as the SERVICE_ACCOUNT_NAME
Serdar Tumgoren
08/20/2021, 6:24 PMSerdar Tumgoren
08/20/2021, 6:25 PMSERVICE_ACCOUNT_NAME
is blankKevin Kho
Serdar Tumgoren
08/20/2021, 6:28 PMtcp
address setting and do any other configuration in the flow script or at the pod layer?Wilson Bilkovich
08/20/2021, 6:31 PMSerdar Tumgoren
08/20/2021, 6:34 PMprefect
with (what I hoped) were appropriate roles, which is how i think i ended up with the prefect
setting for SERVICE_ACCOUNT_NAME. I’ll try debugging that nowKevin Kho
executor = DaskExecutor(address="192.0.2.255:8786")
like detailed here . What Wilson is saying is if you pass in a callable Dask cluster class like KubeCluster
to the exectuor and then it creates those workers on the fly for you.
For an existing cluster, I don’t think there would be more configuration.
That makes sense, I think you can use GCS Storage by passing the env vars to the agent. I think if you follow this , it would be
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"
I don’t know if the best way is to copy that json into your own container. or add it to the pod as a ConfigMap?Serdar Tumgoren
08/20/2021, 6:42 PMkubectl delete pods <podname>
Kevin Kho
Wilson Bilkovich
08/20/2021, 6:47 PMdeployment
if you’d like it to stay goneSerdar Tumgoren
08/20/2021, 6:47 PMWilson Bilkovich
08/20/2021, 6:47 PMSerdar Tumgoren
08/20/2021, 6:48 PMSerdar Tumgoren
08/20/2021, 10:13 PMGOOGLE_APPLICATION_CREDENTIALS=/tmp/secret.json
and, as quick-and-dirty shortcut, copied my GCP credentials JSON file to that /tmp location in the pod. Alas, I’m getting a Failed to load and execute Flow's environment: DefaultCredentialsError('File /tmp/secrets.json was not found.')
error when I attempt to run via Cloud. Wondering if there’s something very dumb I’m doing here? Should I avoid this hackish approach and instead create a container image that contains the gcp credentials file, post it to a private registry, and then specify that image in KubernetesRun?Serdar Tumgoren
08/20/2021, 10:15 PMflow.run_config = KubernetesRun(
env={
'GOOGLE_APPLICATION_CREDENTIALS': '/tmp/secrets.json',
}
)
flow.executor = LocalExecutor()
flow.storage = GCS(
bucket='aw-prefect-flows',
project='hai-gcp-augmenting',
)
Kevin Kho
Serdar Tumgoren
08/21/2021, 1:29 AMSerdar Tumgoren
08/21/2021, 11:42 PMKevin Kho
Serdar Tumgoren
08/21/2021, 11:51 PMSerdar Tumgoren
08/22/2021, 2:00 AMKevin Kho
Serdar Tumgoren
08/22/2021, 4:13 AM