Dekel R
11/30/2021, 8:11 AMFile "/usr/local/lib/python3.9/site-packages/gcsfs/credentials.py", line 84, in _connect_google_default
raise ValueError(msg.format(self.project, project))
ValueError: User-provided project 'my_project' does not match the google default project 'some_generated_id'. Either
Some code snippets and information about my flow -
from prefect import Flow
from prefect.storage import Docker
from tasks.extract_product_data import extract_data
from prefect.run_configs import VertexRun
from prefect.schedules import IntervalSchedule
from datetime import timedelta
schedule = IntervalSchedule(interval=timedelta(days=1))
with Flow("extract_comparable_products_data",
storage=Docker(registry_url="us-central1-docker.pkg.dev/xxxx/",
dockerfile="./Dockerfile"), schedule=schedule) as flow:
extract_data()
flow.run_config = VertexRun(machine_type='e2-standard-16', labels=["ml"],
service_account='<http://prefect_service_account.iam.gserviceaccount.com|prefect_service_account.iam.gserviceaccount.com>')
The flow has only one task for now for testing purposes.
My task is using data from multiple projects of my organization (google cloud projects) so In every google_client interaction I use a specific project as a parameter, for example -
storage_client = storage.Client(project='my_pro_1')
The service account that Prefect use has permissions to all of the relevant projects (In general, storage, Bigquery, Artifactory, Vertex AI) .
Anyone familiar with this issue?
Thanks.Anna Geller
Dekel R
11/30/2021, 9:39 AMAnna Geller
File "/usr/local/lib/python3.9/site-packages/gcsfs/credentials.py", line 84, in _connect_google_default
raise ValueError(msg.format(self.project, project))
without Prefect first and see whether it works locally, and the same with Vertex - perhaps you can start a Vertex AI notebook and try to run the same code there and see if there is no GCS error? This way you could see if the service account works correctly on Vertex AI without Prefect for now.
Based on the error you sent it looks like GCS permissions don’t work with the provided project. Perhaps you could create a new fresh service account with only those permissions and test it out this way?Dekel R
12/01/2021, 7:45 AMAnna Geller
prefect run -p your_flow.py
Anna Geller
prefect register --project xxx -p your_flow.py
prefect run --project xxx --name yyy --watch
You could cross-check the Vertex agent permissions. Based on the docstring:
service_account = Specifies the service account to use
as the run-as account in vertex. The agent submitting jobs must have
act-as permission on this run-as account.
E.g.:
from prefect.run_configs import VertexRun
run_config = VertexRun(service_account="your_account")
Dekel R
12/01/2021, 1:11 PMfrom prefect import Flow, task
from prefect.storage import Docker
from tasks.extract_product_data import extract_data
from prefect.run_configs import VertexRun
from prefect.schedules import IntervalSchedule
from datetime import timedelta
from src.utils import send_slack_alert
schedule = IntervalSchedule(interval=timedelta(days=1))
@task()
def extract():
send_slack_alert('testing stuff - extraction flow')
with Flow("extract_comparable_products_data",
storage=Docker(registry_url="us-central1-docker.pkg.dev/xxx/",
dockerfile="./Dockerfile"), schedule=schedule) as flow:
# extract_data()
extract()
flow.run_config = VertexRun(machine_type='e2-standard-16', labels=["ml"],
service_account='<mailto:prefect-integration@xxx.iam.gserviceaccount.com|prefect-integration@xxx.iam.gserviceaccount.com>')
See the code for send_slack_alert - (works just fine in non Vertex flows)
def send_slack_alert(messege):
secret_slack = Secret("SLACK_WEBHOOK_URL").get()
<http://requests.post|requests.post>(secret_slack, json={"text": messege})
Still doesn’t work, I’m still getting the same error of :
ValueError: User-provided project 'my_project' does not match the google default project 'xxx-tp'. Either
At first I thought the error is connected somehow to the fact I’m getting data from multiple projects - but this flow suggests its not the case…Anna Geller
Dekel R
12/01/2021, 2:24 PMAnna Geller
Dekel R
12/01/2021, 2:39 PMDekel R
12/01/2021, 2:51 PMroles/aiplatform.customCodeServiceAgent
As you can see in this link - https://cloud.google.com/iam/docs/understanding-roles#aiplatform.customCodeServiceAgentAnna Geller
Dekel R
12/09/2021, 1:09 PMBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by