Loop.range generates inconsistent number of iterations when start=end
See original GitHub issue/kind bug
What steps did you take and what happened:
Reproduce using the following code
from kfp import dsl, components
from kfp_tekton.tekton import Loop
op1_yaml = '''\
name: 'my-in-coop1'
inputs:
- {name: item, type: Integer}
- {name: param, type: Integer}
implementation:
container:
image: library/bash:4.4.23
command: ['sh', '-c']
args:
- |
set -e
echo op1 "$0" "$1"
- {inputValue: item}
- {inputValue: param}
'''
@dsl.pipeline(name='pipeline')
def pipeline():
with Loop.range(start=0, step=1, end=0) as item:
op1_template = components.load_component_from_text(op1_yaml)
op1 = op1_template(item, 10)
if __name__ == '__main__':
from kfp_tekton.compiler import TektonCompiler as Compiler
from kfp_tekton.compiler.pipeline_utils import TektonPipelineConf
tekton_pipeline_conf = TektonPipelineConf()
tekton_pipeline_conf.set_tekton_inline_spec(True)
# tekton_pipeline_conf.set_resource_in_separate_yaml(True)
Compiler().compile(pipeline, __file__.replace('.py', '.yaml'), tekton_pipeline_conf=tekton_pipeline_conf)
This generates 0 iterations.
What did you expect to happen:
I expect this to generate 1 iteration given that the loop Loop.range(start=0, step=1, end=1)
generates 2 iterations.
Additional information: [Miscellaneous information that will assist in solving the issue.]
Environment:
- Python Version (use
python --version
): - SDK Version:
- Tekton Version (use
tkn version
): - Kubernetes Version (use
kubectl version
): - OS (e.g. from
/etc/os-release
):
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Why does range(start, end) not include end? - Stack Overflow
The idea is that you get a list of length y-x , which you can (as you see above) iterate over. Read up...
Read more >Loops and iteration - JavaScript - MDN Web Docs
It checks that i is less than the number of options in the <select> element, performs the succeeding if statement, and increments i...
Read more >For loop with range - Learn Python 3 - Snakify
Another use case for a for-loop is to iterate some integer variable in increasing ... Function range(min_value, max_value) generates a sequence with numbers...
Read more >Python range() Function Explained with Examples - PYnative
Python range() returns the sequence of numbers starting from a given start integer to a stop integer, which we can iterate using a...
Read more >For Loop Over a Range - Activities - UiPath Community Forum
I am requesting that a new activity be added that can take a counter variable, start and end numbers, as well as a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
/assign @ScrapCodes
@ScrapCodes are you able to take over this issue?
Is it true of any start e.g. start = 1 and end =1 , should also generate one iteration.