-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: pipeline trigger code + cloud function #30
Conversation
854b2ec
to
7351898
Compare
/gcbrun |
b25aae5
to
d84c7e7
Compare
/gcbrun |
d84c7e7
to
eab027f
Compare
/gcbrun |
bf1118e
to
70dad7a
Compare
/gcbrun |
70dad7a
to
dcaca24
Compare
/gcbrun |
dcaca24
to
e58afb1
Compare
/gcbrun |
e58afb1
to
f11a92d
Compare
/gcbrun |
e5d2766
to
b973d85
Compare
/gcbrun |
b973d85
to
2fd9d61
Compare
enable_caching = os.environ.get("enable_pipeline_caching", None) | ||
if enable_caching: | ||
enable_caching = bool(strtobool(enable_caching)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable_caching = os.environ.get("enable_pipeline_caching", None) | |
if enable_caching: | |
enable_caching = bool(strtobool(enable_caching)) | |
import os.environ as env | |
enable_caching = lower(env.get("enable_pipeline_caching")) in ["1", "true"] |
also, I'd move this to ArgumentParser()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is not correct. If the env variable is not set, the result should be None
, not False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(equally lower(None)
will cause an error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about something like:
enable_caching = os.environ.get("enable_pipeline_caching")
if enable_caching is not None:
enable_caching = lower(enable_caching) in ["1", "true"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will work and default to False
if enable_pipeline_caching
isn't in the env:
enable_caching = os.environ.get("enable_pipeline_caching", None) | |
if enable_caching: | |
enable_caching = bool(strtobool(enable_caching)) | |
enable_caching = lower(env.get("enable_pipeline_caching", "")) in ["1", "true"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to default to None
if not provided
pipeline_root = os.environ["VERTEX_PIPELINE_ROOT"] | ||
service_account = os.environ["VERTEX_SA_EMAIL"] | ||
|
||
enable_caching = os.environ.get("enable_pipeline_caching", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use upper case as we do for other env vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind - this is an env variable that we set when running the command (make run enable_pipeline_caching=true
) rather than one picked up from env.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use upper case to standardise. also, you can change the code to:
enable_caching = os.environ.get("enable_pipeline_caching", None) | |
enable_caching = os.environ.get("enable_pipeline_caching") |
("true", True), | ||
("False", False), | ||
("false", False), | ||
(None, None), # enable_pipeline_caching env var not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "0" and "1"
terraform/modules/scheduled_pipelines/scheduled_jobs.auto.tfvars.example
Show resolved
Hide resolved
/gcbrun |
Looks like we might be blocked by this issue |
/gcbrun |
pipeline_root = os.environ["VERTEX_PIPELINE_ROOT"] | ||
service_account = os.environ["VERTEX_SA_EMAIL"] | ||
|
||
enable_caching = os.environ.get("enable_pipeline_caching", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use upper case to standardise. also, you can change the code to:
enable_caching = os.environ.get("enable_pipeline_caching", None) | |
enable_caching = os.environ.get("enable_pipeline_caching") |
enable_caching = os.environ.get("enable_pipeline_caching", None) | ||
if enable_caching: | ||
enable_caching = bool(strtobool(enable_caching)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will work and default to False
if enable_pipeline_caching
isn't in the env:
enable_caching = os.environ.get("enable_pipeline_caching", None) | |
if enable_caching: | |
enable_caching = bool(strtobool(enable_caching)) | |
enable_caching = lower(env.get("enable_pipeline_caching", "")) in ["1", "true"] |
enable_caching = payload.get("enable_pipeline_caching") | ||
if enable_caching: | ||
enable_caching = bool(strtobool(enable_caching)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable_caching = payload.get("enable_pipeline_caching") | |
if enable_caching: | |
enable_caching = bool(strtobool(enable_caching)) | |
enable_caching = lower(payload.get("enable_pipeline_caching", "")) in ["1", "true"] | |
encryption_spec_key_name = os.environ.get("VERTEX_CMEK_IDENTIFIER") or None | ||
network = os.environ.get("VERTEX_NETWORK") or None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encryption_spec_key_name = os.environ.get("VERTEX_CMEK_IDENTIFIER") or None | |
network = os.environ.get("VERTEX_NETWORK") or None | |
encryption_spec_key_name = os.environ.get("VERTEX_CMEK_IDENTIFIER") | |
network = os.environ.get("VERTEX_NETWORK") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or None
is needed in case the env variable is set to an empty string -> becomes None
instead
Co-authored-by: Felix Schaumann <[email protected]>
It needs to default to |
/gcbrun |
/gcbrun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
Separated the pipeline trigger code (for
make run
) from the Cloud Functionterraform/modules/cloudfunction/src
pipelines/src/pipelines/utils/trigger_pipeline.py
display_name
option to no longer use thetemplate_path
-template_path
might be too long in the case of Artifact Registry URIsupload_pipeline
pr-checks.yaml
CI pipeline now runs unit tests for the util scriptstrigger-tests.yaml
CI pipeline now runs unit tests only for the Cloud Functiontrigger_pipeline
functionPipelineJob
How has this been tested?
make
commands have been tested locallyChecklist