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.
Post
Replies
Boosts
Views
Activity
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()
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?
So I had a similar issue, after dismissing a sheet presented on a view, the view hierarchy gets messy and I could see in the 3D debugger that the frame of my button has been moved from its original position . Changing .sheet to .fullScreenCover solved the issue. I believe this is a swift UI bug.
Xcode Version : 13.4.1 on iOS 15.5