sohojoe commited on
Commit
d1b5501
1 Parent(s): e630a78

fix: give subproc as chance to run

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -114,8 +114,13 @@ async def main():
114
  charles_actor = ray.get_actor("CharlesActor")
115
  system_one_audio_status.write("Charles is here.")
116
  except ValueError as e:
117
- charles_actor_proc = subprocess.Popen(["python3", "charles_actor.py"])
118
- system_one_audio_status.write("Creating an instance of Charles...")
 
 
 
 
 
119
  # import platform
120
  # print (f"platform:{platform.system()}")
121
  # if platform.system() == 'Linux':
@@ -123,6 +128,7 @@ async def main():
123
  # system_one_audio_status.write("Creating Charles.")
124
  # else:
125
  # system_one_audio_status.write("Charles is sleeping.")
 
126
  if charles_actor is not None:
127
  try:
128
  # new_environment_state = await charles_actor.get_environment_state.remote()
 
114
  charles_actor = ray.get_actor("CharlesActor")
115
  system_one_audio_status.write("Charles is here.")
116
  except ValueError as e:
117
+ if 'charles_actor_proc' in locals() or 'charles_actor_proc' in globals() and charles_actor_proc is not None:
118
+ system_one_audio_status.write("Waiting for instance of Charles...")
119
+ else:
120
+ await asyncio.sleep(0.5) # give ray a chance to start
121
+ charles_actor_proc = subprocess.Popen(["python3", "charles_actor.py"])
122
+ system_one_audio_status.write("Creating an instance of Charles...")
123
+ await asyncio.sleep(0.5)
124
  # import platform
125
  # print (f"platform:{platform.system()}")
126
  # if platform.system() == 'Linux':
 
128
  # system_one_audio_status.write("Creating Charles.")
129
  # else:
130
  # system_one_audio_status.write("Charles is sleeping.")
131
+ pass
132
  if charles_actor is not None:
133
  try:
134
  # new_environment_state = await charles_actor.get_environment_state.remote()