-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples with taskflow and dynamic task mapping
- Loading branch information
Showing
3 changed files
with
164 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,45 @@ | ||
from random import randint | ||
|
||
from airflow.operators.python import get_current_context | ||
|
||
|
||
def build_numbers_list(): | ||
return [2, 4, 8] | ||
return [2, 4, 6] | ||
|
||
|
||
def some_number(): | ||
return randint(0, 100) | ||
|
||
|
||
def double(number): | ||
return 2 * number | ||
def double(number: int): | ||
result = 2 * number | ||
print(result) | ||
return result | ||
|
||
|
||
def multiply(a: int, b: int) -> int: | ||
result = a * b | ||
print(result) | ||
return result | ||
|
||
|
||
# added_values = add.expand(x=first_list(), y=second_list()) | ||
|
||
|
||
def double_with_label(number: int, label: bool = False): | ||
result = 2 * number | ||
if not label: | ||
print(result) | ||
return result | ||
else: | ||
label_info = "even" if number % 2 else "odd" | ||
print(f"{result} is {label_info}") | ||
return result, label_info | ||
|
||
|
||
def extract_last_name(full_name: str): | ||
name, last_name = full_name.split(" ") | ||
print(f"{name} {last_name}") | ||
context = get_current_context() | ||
context["custom_mapping_key"] = name | ||
return last_name |