Flows
FileMappedParameter
Bases: MappedParameter
FileMappedParameters describe files passed between different flows. Files are saved as json representations describing file type (and serialization) and filesystem information.
Attr
parent_flow_name (str): Parent flow holding origin of mapped parameter. parent_task_name (str): Task whose result is mapped to the parameter. map_type (Literal["file", "db", "raw"] = "file"): The "file" map type describes the
Source code in lume_services/flows/flow.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
Flow
Bases: BaseModel
Interface to a workflow object.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of flow |
flow_id |
Optional[str]
|
ID of flow as registered with Prefect. If running locally, this will be null. |
project_name |
Optional[str]
|
Name of Prefect project with which the flow is registered. If running locally this will be null. |
parameters |
Optional[Dict[str, Parameter]]
|
Dictionary of Prefect parameters associated with the flow. |
mapped_parameters |
Optional[Dict[str, MappedParameter]]
|
Parameters to be collected from results of other flows. |
task_slugs |
Optional[Dict[str, str]]
|
Slug of tasks associated with the Prefect flow. |
labels |
List[str] = ["lume-services"]
|
List of labels to assign to flow when registering with Prefect backend. This label is used to assign agents that will manage deployment. |
image |
str
|
Image inside which to run flow if deploying to remote backend. |
Source code in lume_services/flows/flow.py
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 161 162 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|
load_flow(scheduling_service=Provide[Context.scheduling_service])
Loads Prefect flow artifact from the backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scheduling_service
|
SchedulingService
|
Scheduling service. If not provided, uses injected service. |
Provide[scheduling_service]
|
Source code in lume_services/flows/flow.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
register(scheduling_service=Provide[Context.scheduling_service])
Register flow with SchedulingService backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scheduling_service
|
SchedulingService
|
Scheduling service. If not provided, uses injected service. |
Provide[scheduling_service]
|
Returns:
Name | Type | Description |
---|---|---|
flow_id |
str
|
ID of registered flow. |
Source code in lume_services/flows/flow.py
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 |
|
run(parameters, scheduling_service=Provide[Context.scheduling_service], **kwargs)
Run the flow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs
|
Arguments passed to run config construction |
{}
|
Source code in lume_services/flows/flow.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
run_and_return(parameters, task_name, scheduling_service=Provide[Context.scheduling_service], **kwargs)
Run flow and return result. Result will reference either passed task name or the result of all tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs
|
Arguments passed to run config construction |
{}
|
Source code in lume_services/flows/flow.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|
MappedParameter
Bases: BaseModel
There are three types of mapped parameters: file, db, and raw.
file: File parameters are file outputs that will be loaded in downstream flows.
Downstream loading must use the packaged load_file
task in
lume_services.tasks.file
.
db: Database results ...
raw: Raw values are passed from task output to parameter input.
Attr
parent_flow_name (str): Parent flow holding origin of mapped parameter. parent_task_name (str): Task whose result is mapped to the parameter. map_type (Literal["file", "db", "raw"]): Type of mapping describing the parameters.
Source code in lume_services/flows/flow.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
RawMappedParameter
Bases: MappedParameter
RawMappedParameters describe parameter mappings where the result of a task is used as the input to a parameter.
Attr
parent_flow_name (str): Parent flow holding origin of mapped parameter. parent_task_name (str): Task whose result is mapped to the parameter. map_type (Literal["file", "db", "raw"] = "raw"): The "raw" map type describes the one-to-one result to parameter map.
Source code in lume_services/flows/flow.py
39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
FlowOfFlows
Bases: Flow
Source code in lume_services/flows/flow_of_flows.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 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 161 162 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
compose(image_name, image_tag='latest', local=False, scheduling_service=Provide[Context.scheduling_service])
Compose Prefect flow from FlowOfFlows object. Uses base image assigned to the FlowOfFlows Object and builds a new Docker image containing the composite flow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_name
|
str
|
Name of generated image. |
required |
image_tag
|
str
|
Tag of generated image. |
'latest'
|
local
|
bool=False
|
Whether to use local images for the base image. |
False
|
Returns:
Type | Description |
---|---|
Flow
|
PrefectFlow |
Source code in lume_services/flows/flow_of_flows.py
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 161 162 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
compose_and_register()
Compose flow and register with project.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Registered flow id |
Source code in lume_services/flows/flow_of_flows.py
234 235 236 237 238 239 240 241 242 243 244 |
|
validate(values)
Validate composing flow data against Prefect server.
Source code in lume_services/flows/flow_of_flows.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 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 |
|