Multiple PhotogrammetrySession running at the same time

I've been trying to run multiple photogrammetry sessions in parallel in different threads but I keep getting this error [Photogrammetry] queueNextProcessingBatchIfNeeded(): Already running a job... not starting new one. This happens even though the session.isProcessing returns false.

Is there someone out there that can help with this issue please ? Thanks a lot

Answered by DTS Engineer in 727893022

So I tried actually initialize different PhotogrammetrySessions but they do not run in parallel. I get this error [Photogrammetry] queueNextProcessingBatchIfNeeded(): Already running a job... not starting new one.

I see the same message, but it doesn't appear to actually cause an issue (see On Log Noise), my sessions continue to run in parallel. Are you certain that your sessions truly are not running in parallel. If so, I'd recommend requesting technical support.

Hello,

Please see the answer in this thread:

https://developer.apple.com/forums/thread/703130

Thank you for your reply, yes I have actually already seen this thread. So the answer in that thread indicates that you can have multiple requests for the same session. But what I really need is to have multiple sessions and run the process in parallel. ( for different sets of images) . Do you have any idea how can I achieve that?

Hello Sadafiou,

But what I really need is to have multiple sessions and run the process in parallel. ( for different sets of images) . Do you have any idea how can I achieve that?

I see, you can simply initialize multiple PhotogrammetrySessions, they will run in parallel. Please request technical support if you aren't sure how to go about this.

So I tried actually initialize different PhotogrammetrySessions but they do not run in parallel. I get this error [Photogrammetry] queueNextProcessingBatchIfNeeded(): Already running a job... not starting new one.

Here is my code :

class Pictures23d {
    func loop(group: DispatchGroup, _ jobNumber: Int? = nil) {

        var session: PhotogrammetrySession?

        print("run \(Date())")

        group.enter()

        print("group enter for job \(String(describing: jobNumber))")

        DispatchQueue(label: "\(jobNumber ?? 0)").async { [weak self] in

            guard let self = self else { return }

            let configuration = self.makeConfiguration()

            do {

                session = try PhotogrammetrySession(input: self.processingConf.inputFolderUrl,

                                                    configuration: configuration)

                self.delegate?.processingStarted()

            } catch {
                Foundation.exit(1)
            }

            guard let session = session else {
                Foundation.exit(1)
            }

            let waiter = self.waiter(group: group, session: session)

            // Compiler may deinitialize these objects since they may appear to be

            // unused. This keeps them from being deallocated until they exit.

            withExtendedLifetime((session, waiter)) {

                // Run the main process call on the request, then enter the main run

                // loop until you get the published completion event or error.

                do {

                    let requests = self.makeRequests()

                    if requests.isEmpty {
                        Foundation.exit(1)
                    }

                    try session.process(requests: requests)
                    RunLoop.current.run()

                } catch {
                    Foundation.exit(1)
                }
            }
        }
    }

and from another class this is how I run it:

            let group = DispatchGroup()

            var index  = 0

            for conf in list {

                let picture23dsession = Pictures23d(processingConf: conf)

                picture23dsession.loop(group: group, index + 1000)

                index += 1

                // Everything went fine

                let loadResult = String(describing: picture23dsession.lodResults)
            }

            group.wait()
Accepted Answer

So I tried actually initialize different PhotogrammetrySessions but they do not run in parallel. I get this error [Photogrammetry] queueNextProcessingBatchIfNeeded(): Already running a job... not starting new one.

I see the same message, but it doesn't appear to actually cause an issue (see On Log Noise), my sessions continue to run in parallel. Are you certain that your sessions truly are not running in parallel. If so, I'd recommend requesting technical support.

Yep! that was the issue. They are actually running in parallel! it was just the log noise! Thank you for your help. I appreciate it.

Multiple PhotogrammetrySession running at the same time
 
 
Q