Forum

Author Topic: RunScript() dont run over network  (Read 681 times)

3dlancer

  • Newbie
  • *
  • Posts: 2
    • View Profile
RunScript() dont run over network
« on: March 05, 2024, 12:50:02 PM »
I am encountering an issue where tasks submitted for batch processing through both the Metashape GUI and Python scripts do not initiate. The core of the problem seems to be that no workers are assigned to the tasks, showing a status of 0/0 workers, regardless of the submission method. This occurs during the following process:

1. In the Metashape GUI, I navigate to Workflow -> Batch Process -> Add -> Run Script, then select any file and submit it to the network. However, the task does not start due to 0/0 workers being assigned.
2. Similarly, when submitting a Run Script task via Python, the same issue of 0/0 workers being assigned is observed.

I found a temporary workaround by exporting the batch tasks from the monitor, manually editing the XML to set the worker count to 1, and then reimporting it. After this manual adjustment, the script processes as expected.

I am inquiring if there exists a more streamlined workaround or a feature that allows for the direct submission of tasks with scripts over the network. Specifically, is it possible to submit custom JSON or XML directly to the Metashape server, bypassing the need to use the RunScript() function?

Additionally, it would be immensely beneficial if there was a way to specify the number of workers when submitting a script for batch processing. Ideally, setting this number to, for example, 3, would enable the script to run in parallel across three machines. This would not only bypass the limitation of restricting a batch script to a single machine but also enhance efficiency by leveraging parallel processing capabilities. The logic for parallel processes could be embedded within the Python script itself, necessitating only the addition of a parameter to dictate the desired number of executions.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14968
    • View Profile
Re: RunScript() dont run over network
« Reply #1 on: March 05, 2024, 01:07:45 PM »
Hello 3dlancer,

This bug has been reported recently and will be fixed in the next version update.

You can use 2.1.1 pre-release (should be updated both on nodes and server):
https://s3-eu-west-1.amazonaws.com/download.agisoft.com/metashape-pro_2_1_1_x64.msi
https://s3-eu-west-1.amazonaws.com/download.agisoft.com/metashape-pro_2_1_1.dmg
https://s3-eu-west-1.amazonaws.com/download.agisoft.com/metashape-pro_2_1_1_amd64.tar.gz
Best regards,
Alexey Pasumansky,
Agisoft LLC

3dlancer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: RunScript() dont run over network
« Reply #2 on: March 06, 2024, 11:52:39 AM »
Thanks for helping, submitting now seems to start the script but I encountered a new challenge

Issue: Import operations in test.py hang when executed via Runscript over a network, notably the import cv2, pymeshlab command, while the same import works in main.py.
Environment: Server and client operations occur on the same machine, with an identical environment setup for both main.py and test.py. The issue is confirmed under these conditions, with no other machine involved.

Observation: Some imports like tqdm function correctly, yet most others do not and result in a hang without any error output.

Testing Conditions: The problem is specific to networked script execution through Runscript. Direct imports in main.py or from the script initiating the Runscript task work as expected.

Actions Taken:
Confirmed both main.py and test.py run under the same Python environment, versions, and paths. This was verified by a utility function (show_python_info) that outputs the Python version, installation directory, site-packages directory, Python search paths (sys.path), system platform, and Python executable. Results were consistent across both scripts.

For Replication:
Test by executing a script containing import cv2 via Runscript over a network. Observe the hanging issue during the import process.