-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raw Container Task Local Execution (#2258)
* init Signed-off-by: Future-Outlier <[email protected]> * v1 Signed-off-by: Future-Outlier <[email protected]> * argurments bug fixed and add log when pulling image Signed-off-by: Future-Outlier <[email protected]> * change v to k and handle boolean special case Signed-off-by: Future-Outlier <[email protected]> * support blob type and datetime Signed-off-by: Future-Outlier <[email protected]> * add unit tests Signed-off-by: Future-Outlier <[email protected]> * add exception Signed-off-by: Future-Outlier <[email protected]> * nit Signed-off-by: Future-Outlier <[email protected]> * fix test Signed-off-by: Future-Outlier <[email protected]> * update for flytefile and flytedirectory Signed-off-by: Future-Outlier <[email protected]> * support both file paths and template inputs Signed-off-by: Future-Outlier <[email protected]> * pytest use sys platform to handle macos and windows case and support regex to parse the input Signed-off-by: Future-Outlier <[email protected]> * support datetime.timedelta Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * add tests and change boolean logic Signed-off-by: Future-Outlier <[email protected]> * support Signed-off-by: Future-Outlier <[email protected]> * change annotations Signed-off-by: Future-Outlier <[email protected]> * add flytefile and flytedir tests Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * add more tests Signed-off-by: Future-Outlier <[email protected]> * lint Signed-off-by: Future-Outlier <[email protected]> * change image name Signed-off-by: Future-Outlier <[email protected]> * Update pingsu's advice Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Kevin Su <[email protected]> * add docker in dev-requirement Signed-off-by: Future-Outlier <[email protected]> * refactor execution Signed-off-by: Future-Outlier <[email protected]> * use render pattern Signed-off-by: Future-Outlier <[email protected]> * add back container task object in test Signed-off-by: Future-Outlier <[email protected]> * refactor output in container task execution Signed-off-by: Future-Outlier <[email protected]> * update pingsu's render input advice Signed-off-by: Future-Outlier <[email protected]> * update tests Signed-off-by: Future-Outlier <[email protected]> * add LiteralMap TypeHints Signed-off-by: Future-Outlier <[email protected]> * update dev-req Signed-off-by: Future-Outlier <[email protected]> --------- Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
- Loading branch information
1 parent
9cd1b13
commit edb6037
Showing
7 changed files
with
525 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM python:3.9-alpine | ||
|
||
WORKDIR /root | ||
|
||
COPY ./write_flytefile.py /root/write_flytefile.py | ||
COPY ./write_flytedir.py /root/write_flytedir.py | ||
COPY ./return_same_value.py /root/return_same_value.py | ||
|
||
CMD ["/bin/sh"] |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
import sys | ||
|
||
|
||
def write_output(output_dir, output_file, v): | ||
# Ensure the output directory exists | ||
os.makedirs(output_dir, exist_ok=True) # This will create the directory if it doesn't exist | ||
with open(f"{output_dir}/{output_file}", "w") as f: | ||
f.write(str(v)) | ||
|
||
|
||
def main(*args, output_dir): | ||
# Generate output files for each input argument | ||
for i, arg in enumerate(args, start=1): | ||
# Using i to generate filenames like 'a', 'b', 'c', ... | ||
output_file = chr(ord("a") + i - 1) | ||
write_output(output_dir, output_file, arg) | ||
|
||
|
||
if __name__ == "__main__": | ||
*inputs, output_dir = sys.argv[1:] # Unpack all inputs except for the last one for output_dir | ||
main(*inputs, output_dir=output_dir) |
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
Oops, something went wrong.