prefect_gcp.utilities
Execution
Bases: BaseModel
Utility class to call GCP executions
API and
interact with the returned objects.
Source code in prefect_gcp/utilities.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
condition_after_completion()
Returns Execution condition if Execution has completed.
Source code in prefect_gcp/utilities.py
180 181 182 183 184 |
|
get(client, namespace, execution_name)
classmethod
Make a get request to the GCP executions API and return an Execution instance.
Source code in prefect_gcp/utilities.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
is_running()
Returns True if Execution is not completed.
Source code in prefect_gcp/utilities.py
176 177 178 |
|
succeeded()
Whether or not the Execution completed is a successful state.
Source code in prefect_gcp/utilities.py
186 187 188 189 190 191 192 |
|
Job
Bases: BaseModel
Utility class to call GCP jobs
API and
interact with the returned objects.
Source code in prefect_gcp/utilities.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
create(client, namespace, body)
staticmethod
Make a create request to the GCP jobs API.
Source code in prefect_gcp/utilities.py
141 142 143 144 145 146 |
|
delete(client, namespace, job_name)
staticmethod
Make a delete request to the GCP jobs API.
Source code in prefect_gcp/utilities.py
148 149 150 151 152 153 |
|
get(client, namespace, job_name)
classmethod
Make a get request to the GCP jobs API and return a Job instance.
Source code in prefect_gcp/utilities.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
has_execution_in_progress()
See if job has a run in progress.
Source code in prefect_gcp/utilities.py
101 102 103 104 105 106 |
|
is_ready()
Whether a job is finished registering and ready to be executed
Source code in prefect_gcp/utilities.py
95 96 97 98 99 |
|
run(client, namespace, job_name)
staticmethod
Make a run request to the GCP jobs API.
Source code in prefect_gcp/utilities.py
155 156 157 158 159 160 |
|
slugify_name(name, max_length=30)
Slugify text for use as a name.
Keeps only alphanumeric characters and dashes, and caps the length of the slug at 30 chars.
The 30 character length allows room to add a uuid for generating a unique name for the job while keeping the total length of a name below 63 characters, which is the limit for Cloud Run job names.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the job |
required |
Returns:
Type | Description |
---|---|
Optional[str]
|
The slugified job name or None if the slugified name is empty |
Source code in prefect_gcp/utilities.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|