Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: cojeffj on November 18, 2020, 07:28:26 PM

Title: Split in chunks - network processing enabled
Post by: cojeffj on November 18, 2020, 07:28:26 PM
I'm attempting to modify the split in chunks script to take advantage of network processing. What I've done is add a checkbox to the custom menu GUI, and if that is checked then send the task to the network client. As others have noted before (andyroo) the script needs to wait for the current task to finish.  Would this be a good way to accomplish that, or would I need to think about a whole new way to rewrite the script?
Code: [Select]
if useNetwork:
                                task.network_distribute = True
                                n_task = Metashape.NetworkTask()
                                n_task.name = task.name
                                n_task.params = task.encode()
                                n_task.frames.append((new_chunk.key, 0))
                                network_tasks.append(n_task)
                                batch_id = client.createBatch(path[len(root):], network_tasks)
                                client.resumeBatch(batch_id)
                                #wait until task is complete to continue
                                while not client.batchStatus(batch_id) == 'StatusCompleted':
                                    time.sleep(5)
else:
                                task.apply(new_chunk)
Title: Re: Split in chunks - network processing enabled
Post by: Alexey Pasumansky on November 24, 2020, 04:02:45 PM
Hello cojeffj,

I think that the split-in-chunks script should be completely re-written, if it should properly support network processing functionality.

It may be not that straightforward, if the custom workflow parts of script should be also executed as a network task.

It might be easier, to create the pack of sub-tasks for multiple chunks (like dense cloud or mesh generation) and send them as network task to the server, but the script should be then monitoring, when the task is over on the server, then re-open the project and proceed with the further steps, which would require re-assignment of the variables.
Title: Re: Split in chunks - network processing enabled
Post by: cojeffj on November 30, 2020, 05:52:42 PM
Ok thanks Alexey!