Hello Sören,
I think some examples have been already published earlier, but anyway, below is a small example that exploits Metashape.Tasks sub-classes for more convenient operation:
import Metashape
path = Metashape.app.getOpenFileName("Specify path to the PSX document:")
root = Metashape.app.getExistingDirectory("Specify network root path:")
doc = Metashape.Document()
doc.open(path)
chunk = doc.chunk
network_tasks = list()
### match photos
task = Metashape.Tasks.MatchPhotos()
task.downscale = Metashape.Accuracy.HighAccuracy
task.keypoint_limit = 40000
task.tiepoint_limit = 4000
task.preselection_generic = True
task.preselection_reference = True
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
###align cameras
task = Metashape.Tasks.AlignCameras()
task.adaptive_fitting = False
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append(chunk.key)
network_tasks.append(n_task)
### depth maps
task = Metashape.Tasks.BuildDepthMaps()
task.downscale = Metashape.Quality.MediumQuality
task.filter_mode = Metashape.FilterMode.MildFiltering
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
### dense cloud
task = Metashape.Tasks.BuildDenseCloud()
task.point_colors = True
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
### DEM
task = Metashape.Tasks.BuildDem()
task.source_data = Metashape.DataSource.DenseCloudData
task.interpolation = Metashape.Interpolation.Extrapolated
task.projection = chunk.crs
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
### Orthomosaic
task = Metashape.Tasks.BuildOrthomosaic()
task.ortho_surface = Metashape.DataSource.ElevationData
task.resolution = 0.05
task.projection = chunk.crs
task.blending_mode = Metashape.BlendingMode.MosaicBlending
task.network_distribute = True
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
#### export
task = Metashape.Tasks.ExportPoints()
task.data_source = Metashape.DataSource.DenseCloudData
task.format = Metashape.PointsFormat.PointsFormatLAS
task.export_colors = True
task.coordinates = chunk.crs
task.path = "\\export\\point_cloud.las"
n_task = Metashape.NetworkTask()
n_task.name = task.name
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))
network_tasks.append(n_task)
### running processing:
client = Metashape.NetworkClient()
client.connect("192.168.0.2") #server ip
batch_id = client.createBatch(path[len(root):], network_tasks)
client.resumeBatch(batch_id)
Hope there are no typos, but general idea is shown anyway.