Skip to content

Commit

Permalink
Fix CI ruff check for the take_nap.py file recently added
Browse files Browse the repository at this point in the history
Fixes CI ruff code-style check for recently added file [1,2]

[1] red-hat-data-services#1162
[2] db7d9c1
  • Loading branch information
jstourac committed Jan 26, 2024
1 parent 29b646f commit 0aac140
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions ods_ci/tests/Resources/Files/pipeline-samples/take_nap.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
from kfp import dsl
from kfp import components
from kfp import components, dsl


def take_nap(naptime_secs: int) -> str:
"""Sleeps for secs"""
from time import sleep

print(f"Sleeping for {naptime_secs} seconds: Zzzzzz ...")
sleep(naptime_secs)
return "I'm awake now. Did I snore?"



def wake_up(message: str):
"""Wakes up from nap printing a message"""
print(message)



take_nap_op = components.create_component_from_func(
take_nap, base_image='registry.redhat.io/ubi8/python-39@sha256:3523b184212e1f2243e76d8094ab52b01ea3015471471290d011625e1763af61')
take_nap,
base_image="registry.redhat.io/ubi8/python-39@sha256:3523b184212e1f2243e76d8094ab52b01ea3015471471290d011625e1763af61",
)

wake_up_op = components.create_component_from_func(
wake_up, base_image='registry.redhat.io/ubi8/python-39@sha256:3523b184212e1f2243e76d8094ab52b01ea3015471471290d011625e1763af61')

@dsl.pipeline(
name='take-nap-pipeline',
description='Pipeline that sleeps for 15 mins (900 secs)'
wake_up,
base_image="registry.redhat.io/ubi8/python-39@sha256:3523b184212e1f2243e76d8094ab52b01ea3015471471290d011625e1763af61",
)


@dsl.pipeline(
name="take-nap-pipeline",
description="Pipeline that sleeps for 15 mins (900 secs)",
)
def take_nap_pipeline(naptime_secs: int = 900):
take_nap_task = take_nap_op(naptime_secs)
wake_up_task = wake_up_op(message=take_nap_task.output)
take_nap_task = take_nap_op(naptime_secs)
wake_up_task = wake_up_op(message=take_nap_task.output)


if __name__ == "__main__":
from kfp_tekton.compiler import TektonCompiler

if __name__ == '__main__':
from kfp_tekton.compiler import TektonCompiler
TektonCompiler().compile(take_nap_pipeline, package_path=__file__.replace('.py', '.yaml'))
TektonCompiler().compile(
take_nap_pipeline, package_path=__file__.replace(".py", ".yaml")
)

0 comments on commit 0aac140

Please sign in to comment.