Hops in hops / Compute concurrent request

Hi all,

To the devs @AndyPayne and @stevebaer, I think you guys could help me on this.

  1. Can I call a Hops definition inside a Hops definition ? If so, I saw some parameters for max nesting or so passing by when testing, how should I proceed to make it run ?

  2. Can I force a Hops definition to be “freshly” loaded, I have issue with GGym plugin, it seems to save context of the last call and starting at the 2nd Hops call the outputs are mixed up. If I set the path of the Hops script again, it somehow “clears” it and I can call it again without issues. I tried disabling both cache options but no success, except if I manually set the path again. As I have 60+ iterations to do it would save me a lot of time if you could help me here.

  3. Can I increase the number of concurrent calls admitted ? If yes where can I set it ?

Thanks a lot in advance for the answers and all the best to you guys.

  1. There is a recursion limit which is hard-coded at 10, but I have yet to see that limit reached in most practical applications. You can nest Hops components inside other Hops definitions and it will work fine… but if you’re running into a technical limit, I would like to look at an example and see what can be done. We could make the recursion limit configurable by the end user, but again, I haven’t seen many requests by other users for this.
  2. Turning the cache off for memory and server should force a request to be sent to compute on any Grasshopper change… you should see that request reflected in the console application. If this is not happening, then this could be a bug… but again, it should work that way. If it’s not updating (but requests are sent, etc.) then perhaps it’s a bug with the 3rd party plugin.
  3. You can set the Max Concurrent Request limit in the Hops preferences section. Go to Grasshopper Preferences → Solver and look for the appropriate input box.

Hi,

Thanks for your answer.

  1. I think I might have seen 1 as the recursion limit during my testing. I will try a small test script to check this in particular.

  2. It’s then definitely something wrong happening on my side. I will try to isolate if it comes from hops/compute or from the 3rd party plugin.

  3. Indeed. I might experiment a bit more about it and check if that runs fine.

I’ll keep you posted soon. Thanks again Andy for your being so responsive, you rock.

1 Like

Hi @AndyPayne ,

I’ve made a simpler test case, with a python script (really dumb print of a filepath) nested in 2 levels of Hops calls. I am encountering multiple issues :

  1. The loading time is really long (20 seconds) for just the level 1 /io request to respond. Is it spinning up a new Rhino “sub-instance” every time ? Can’t it use one of my compute instances that are already running on my local maching (I have 4 instances running, 6001,6002,6003,6004 port numbers) ?
  2. The caller gets no output from level 1 hops : Tx output is empty

Can you once run those files on your side, and see if you can spot something wrong ? The behaviour seems really weird on my end. So, “caller.gh” calls “level1.gh” over Hops, and “level1.gh” calls “level2.gh” over Hops. I’ve internalised what I used as input for testing in “caller.gh”
Thanks a lot already for your help and support,

Cheers,

Loïc
level2.gh (4.7 KB)
level1.gh (2.6 KB)
caller.gh (2.9 KB)

Hi Loic,
I was unable to repeat the issue you’re reporting here. I don’t see any lag time in the computation. I did have to replace the Hops component in the definition you posted and created a new one and pointed it to the appropriate file. But, it seems to be working on my end. Perhaps it was the “internalized” part? If you are selecting the “internalized” feature, then theoretically, you shouldn’t need to also send the original base file since the file will now be internalized in the caller script. I have not included that feature here, but am merely attaching the 3 files. I’ve also modified them a bit to remove some extra slashes that Hops appears to add when returning a file path. Lastly, I don’t think the lag you’re seeing is because of rhino.compute spinning up extra children. For one, you would be able to see a report of these children spinning up in the console window. Additionally, it appears as though you already have 4 children spun up (6001, 6002, 6003, 6004) so it shouldn’t be trying to spin up others.
Can you try opening the caller_AP.gh file attached below (make sure it’s downloaded into the same folder as the other two files) and trying running it? Do you still see a delay?

caller_AP.gh (5.6 KB)
level1_AP.gh (6.2 KB)
level2_AP.gh (9.2 KB)

Hi Andy,

I’ve launched a fresh instance of Rhino, opened GH and opened your caller_AP.gh file.
Rhino.compute started automatically. Then I connected the Filepath component to the Hops component to start the computation. I still get similar behaviour to my script from yesterday, empty output :

[09:29:48 INF] Rhino compute started at 02/04/2024 09:29:48
[09:29:48 INF] Initiliazing reverse proxy at 02/04/2024 09:29:48
[09:29:48 INF] Spawn children at startup is set to True
[09:29:48 INF] Now listening on: http://localhost:6500
[09:29:48 INF] Application started. Press Ctrl+C to shut down.
[09:29:48 INF] Hosting environment: Production
[09:29:48 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [09:29:53 INF] Child process started at 02/04/2024 09:29:53
CG  [09:29:53 INF] Parsed port = 6001
CG  [09:29:59 INF] (1/3) Loading rhino scripting plugin
CG  [09:29:59 INF] Successfully loaded scripting plugin
CG  [09:29:59 INF] (2/3) Loading grasshopper
CG  [09:30:04 INF] (3/3) Loading compute plug-ins
CG  [09:30:05 INF] Now listening on: http://localhost:6001
CG  [09:30:05 INF] Application started. Press Ctrl+C to shut down.
CG  [09:30:05 INF] Hosting environment: Production
CG  [09:30:05 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [09:30:09 INF] Child process started at 02/04/2024 09:30:09
CG  [09:30:09 INF] Parsed port = 6002
[09:30:10 INF] HTTP POST /io responded 200 in 21617.2541 ms
CG  [09:30:13 INF] (1/3) Loading rhino scripting plugin
CG  [09:30:13 INF] Successfully loaded scripting plugin
CG  [09:30:13 INF] (2/3) Loading grasshopper
CG  [09:30:19 INF] (3/3) Loading compute plug-ins
CG  [09:30:19 INF] Now listening on: http://localhost:6002
CG  [09:30:19 INF] Application started. Press Ctrl+C to shut down.
CG  [09:30:19 INF] Hosting environment: Production
CG  [09:30:19 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
[09:30:26 INF] HTTP POST /grasshopper responded 200 in 73.5439 ms
[09:30:48 INF] Max concurrent requests = 1
[09:31:48 INF] Max concurrent requests = 0
[09:32:48 INF] Max concurrent requests = 0
[09:33:48 INF] Max concurrent requests = 0

What is weird is the fast response time when calling from caller_AP.gh (xx ms), and then this Max concurrent requests = 1 printout that states something is still being computed ? I had similar behavior yesterday with my script.

Also, the fact that the output is empty makes me think something goes wrong on my side.

I’ve tried to run the level1_AP.gh to check if it’s due to the nested call.
The result is fast and seems correct :

On another note, not sure if it’s linked but:

I have Launch Local Rhino.Compute at Start option disabled.
After PC restart and opening Rhino+GH, I open the settings and click Child Process Count.
I get the following 8 children spawned, eventhough the amount is set to 4.
During the loading I always get 1 error with /launch 500.
Is that ok ?

EDIT 2024/05/24 : Tracked here on YT

[10:02:14 INF] Rhino compute started at 02/04/2024 10:02:14
[10:02:14 INF] Initiliazing reverse proxy at 02/04/2024 10:02:14
[10:02:14 INF] Spawn children at startup is set to True
[10:02:14 INF] Now listening on: http://localhost:6500
[10:02:14 INF] Application started. Press Ctrl+C to shut down.
[10:02:14 INF] Hosting environment: Production
[10:02:14 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:02:19 INF] Child process started at 02/04/2024 10:02:19
CG  [10:02:19 INF] Parsed port = 6001
CG  [10:02:25 INF] (1/3) Loading rhino scripting plugin
CG  [10:02:26 INF] Successfully loaded scripting plugin
CG  [10:02:26 INF] (2/3) Loading grasshopper
CG  [10:02:33 INF] (3/3) Loading compute plug-ins
CG  [10:02:34 INF] Now listening on: http://localhost:6001
CG  [10:02:34 INF] Application started. Press Ctrl+C to shut down.
CG  [10:02:34 INF] Hosting environment: Production
CG  [10:02:34 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:02:39 INF] Child process started at 02/04/2024 10:02:39
CG  [10:02:39 INF] Parsed port = 6002
CG  [10:02:43 INF] Child process started at 02/04/2024 10:02:43
CG  [10:02:43 INF] Parsed port = 6003
CG  [10:02:43 INF] (1/3) Loading rhino scripting plugin
CG  [10:02:44 INF] Successfully loaded scripting plugin
CG  [10:02:44 INF] (2/3) Loading grasshopper
CG  [10:02:46 INF] (1/3) Loading rhino scripting plugin
CG  [10:02:46 INF] Successfully loaded scripting plugin
CG  [10:02:46 INF] (2/3) Loading grasshopper
CG  [10:02:47 INF] Child process started at 02/04/2024 10:02:47
CG  [10:02:47 INF] Parsed port = 6004
CG  [10:02:51 INF] (1/3) Loading rhino scripting plugin
CG  [10:02:52 INF] Child process started at 02/04/2024 10:02:52
CG CG  [ [10:02:5210:02:52  INFINF] ] Parsed port = 6005Successfully loaded scripting plugin

CG  [10:02:52 INF] (2/3) Loading grasshopper
CG  [10:02:55 INF] (3/3) Loading compute plug-ins
CG  [10:02:56 INF] Now listening on: http://localhost:6002
CG  [10:02:56 INF] Application started. Press Ctrl+C to shut down.
CG  [10:02:56 INF] Hosting environment: Production
CG  [10:02:56 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:02:56 INF] Child process started at 02/04/2024 10:02:56
CG  [10:02:57 INF] Parsed port = 6006
CG  [10:02:58 INF] (1/3) Loading rhino scripting plugin
CG  [10:02:58 INF] Successfully loaded scripting plugin
CG  [10:02:58 INF] (2/3) Loading grasshopper
CG  [10:02:59 INF] (3/3) Loading compute plug-ins
CG  [10:02:59 INF] Now listening on: http://localhost:6003
CG  [10:02:59 INF] Application started. Press Ctrl+C to shut down.
CG  [10:02:59 INF] Hosting environment: Production
CG  [10:02:59 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:03:01 INF] (1/3) Loading rhino scripting plugin
CG  [10:03:01 INF] Successfully loaded scripting plugin
CG  [10:03:01 INF] (2/3) Loading grasshopper
CG  [10:03:01 INF] Child process started at 02/04/2024 10:03:01
CG  [10:03:02 INF] Parsed port = 6007
CG  [10:03:05 INF] (3/3) Loading compute plug-ins
CG  [10:03:05 INF] Now listening on: http://localhost:6004
CG  [10:03:05 INF] Application started. Press Ctrl+C to shut down.
CG  [10:03:05 INF] Hosting environment: Production
CG  [10:03:05 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:03:06 INF] (1/3) Loading rhino scripting plugin
[10:03:06 ERR] HTTP GET /launch responded 500 in 51068.1105 ms
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
--- End of stack trace from previous location ---
   at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
[10:03:06 ERR] Connection id "0HN2ITCQRPMNR", Request id "0HN2ITCQRPMNR:00000001": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
--- End of stack trace from previous location ---
   at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
CG  [10:03:06 INF] Child process started at 02/04/2024 10:03:06
CG  [10:03:06 INF] Parsed port = 6008
CG  [10:03:06 INF] Successfully loaded scripting plugin
CG  [10:03:06 INF] (2/3) Loading grasshopper
CG  [10:03:10 INF] (1/3) Loading rhino scripting plugin
CG  [10:03:11 INF] Successfully loaded scripting plugin
CG  [10:03:11 INF] (2/3) Loading grasshopper
CG  [10:03:12 INF] (3/3) Loading compute plug-ins
CG  [10:03:13 INF] Now listening on: http://localhost:6005
CG  [10:03:13 INF] Application started. Press Ctrl+C to shut down.
CG  [10:03:13 INF] Hosting environment: Production
CG  [10:03:13 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
[10:03:14 INF] Max concurrent requests = 0
CG  [10:03:15 INF] (3/3) Loading compute plug-ins
CG  [10:03:16 INF] Now listening on: http://localhost:6006
CG  [10:03:16 INF] Application started. Press Ctrl+C to shut down.
CG  [10:03:16 INF] Hosting environment: Production
CG  [10:03:16 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:03:19 INF] (3/3) Loading compute plug-ins
CG  [10:03:19 INF] Now listening on: http://localhost:6007
CG  [10:03:19 INF] Application started. Press Ctrl+C to shut down.
CG  [10:03:19 INF] Hosting environment: Production
CG  [10:03:19 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute
CG  [10:03:21 INF] (3/3) Loading compute plug-ins
CG  [10:03:21 INF] Now listening on: http://localhost:6008
CG  [10:03:22 INF] Application started. Press Ctrl+C to shut down.
CG  [10:03:22 INF] Hosting environment: Production
CG  [10:03:22 INF] Content root path: C:\Users\loicg\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.6\rhino.compute

Hello @AndyPayne,

I am still working on this, have been doing other things in between, but it seems to me that this topic remains unclear.
I also experienced yesterday timeouts after 100s even after setting the timeout in the preference to more than 100 (180s) in my case.
I just get less and less convinced that I will ever be able to use compute in production, there seem to be many failure points that I just can’t explain for now.
When “manually” operated I can still kill processes, restart Rhino, etc. But soon I need a solution that works automatically and reliably.

EDIT : Needed to update Environment Variable

Hi @Laoky I’m sorry to hear you’re still having trouble. Regarding the timeout issue… there are actually two different places to set the TIMEOUT setting. The first is in the Hops preferences section and this tells Hops how long to wait before timing out. The second is via an environment variable and this setting tells Rhino.Compute how long to wait before timing out. There are detailed instructions on how to set this setting up here. My recommendation would be to see if setting both of these to higher values will fix the timeout issue you’re seeing.
Regarding the launch issue when you increase the child count number and then click on the Child Process Count button… this is something I can repeat here. I will need to investigate this further, but I’ve created a YT issue for this.
Regarding your issue with the max concurrent requests… From what I can tell from your console output, your request is receiving a response code of 200 which means that it worked as expected and you should see some sort of result. I wouldn’t worry too much about the max concurrent message that gets printed to the console window. That message is generated here. You can see in the code that it’s simply tracking the number of concurrent requests it receives in a minute and prints that number to the console window. After 1 minute, it resets itself and begins tracking again. So, I don’t think it’s too big of a concern to see something other than zero here… so long as you’re still getting response codes of 200 which means the response generated properly.
Perhaps you and I can setup a meeting to discuss your project/issues directly. Feel free to email me directly (or DM here) to set up a time that is convenient.

1 Like

From there, I’ve run again the same method and had the same issue (empty output). However this time I opened then level1_AP.gh to check, saw nothing wrong, and then i hit save. Then magically the caller_AP.gh returned a correct value. It’s maybe due to the relative paths ? Anyway this resolves the nesting issue for now.

That is correct. Currently Hops only works with full paths (not relative file paths).

I have a shear model I’m trying to run in grasshopper with rhino 8. It just long loads and I didn’t see a change in the computer parameters that identified an update for what I thought hops does? What do I need to do to get hops running on my shear script?

I’m not sure I understand. Are you trying to load a model that used to work in Hops, but now doesn’t? Or are you trying to load a Grasshopper definition (that may or may not have been “prepared” for Rhino.Compute/Hops) and it isn’t working? Can you upload the script here? If you can’t share it here, you can upload it directly to us here.

What is a full path versus the reletive path?

The full path specifies the complete location to a file, while the relative path only specifies the location relative to a working directory. Let’s say you have a directory on your machine where you’re working on a project. We’ll say this is in the C:\Users\username\Desktop directory and the name of the root folder is called “My Project”. Let’s say this is our working directory. Then inside this directory are several sub folders one of which is called “Grasshopper” and it contains the file we’re looking for titled “AwesomeFile.gh”. So, the full path to this file would be C:\Users\username\Desktop\MyProject\Grasshopper\AwesomeFile.gh while the relative path would simply be Grasshopper\AwesomeFile.gh. Hops really only works with full paths.