0

I want to pass value to livy code from python. But the value I am passing is changing after each call but the value that goes to livy remains same.

data_while_loop = {
    'code': textwrap.dedent("""
    user_data_dict = """ + str(user_ver_dict) + """
    """
}

i = 0
map = {}
while i<10:
   map['x'] = i
   "statement to call value and pass map to livy code"
   i+=1

But the value in the first iteration is as expected. But not in subsequent iteration. when map['x'] is passed in livy's code.In the while loop the value of map['x'] is being sent to above livy's code.

Van Peer
  • 2,127
  • 2
  • 25
  • 35
Affan
  • 85
  • 2
  • 9

1 Answers1

0

I solved the problem by moving the data_while_loop variable inside the while loop after the map['x'] = i command. This basically overwrites every time data_while_loop is called and the latest value of map variable is passed to livy code.

Affan
  • 85
  • 2
  • 9