Mercurial > hg > orthanc
changeset 6643:4f05311b113b
unserialize store job
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Mon, 30 Mar 2026 12:47:58 +0200 |
| parents | 7c587343e308 |
| children | 38f8a3b3d04e |
| files | NEWS OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.cpp OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.h OrthancServer/Sources/ServerJobs/StoreJob.cpp OrthancServer/Sources/ServerJobs/StoreJob.h TODO |
| diffstat | 6 files changed, 29 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Mar 30 11:36:16 2026 +0200 +++ b/NEWS Mon Mar 30 12:47:58 2026 +0200 @@ -15,8 +15,6 @@ * When performing a C-Store or a peer transfer, the instances are now grouped per series and ordered by their InstanceNumber instead of using a random order in previous Orthanc versions. -TODO before release: - reconfigure the instancesLoader when unserializing a C-Store or peer job - - serialize the ParentResources in C-Store and peer job * New experimental configuration "PatientLevelEnabled". TODO before release: re-enable test_content_disposition
--- a/OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.cpp Mon Mar 30 11:36:16 2026 +0200 +++ b/OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.cpp Mon Mar 30 12:47:58 2026 +0200 @@ -274,4 +274,15 @@ hasTrailingStep_ = false; } } + + void SetOfInstancesJob::GetInstancesIds(std::vector<std::string>& target) const + { + target.clear(); + target.reserve(GetCommandsCount()); + + for (size_t i = 0; i < GetCommandsCount(); ++i) + { + target.push_back(dynamic_cast<const InstanceCommand&>(GetCommand(i)).GetInstance()); + } + } }
--- a/OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.h Mon Mar 30 11:36:16 2026 +0200 +++ b/OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.h Mon Mar 30 12:47:58 2026 +0200 @@ -51,6 +51,7 @@ // Hiding this method, use AddInstance() instead using SetOfCommandsJob::AddCommand; + void GetInstancesIds(std::vector<std::string>& target) const; public: SetOfInstancesJob();
--- a/OrthancServer/Sources/ServerJobs/StoreJob.cpp Mon Mar 30 11:36:16 2026 +0200 +++ b/OrthancServer/Sources/ServerJobs/StoreJob.cpp Mon Mar 30 12:47:58 2026 +0200 @@ -45,6 +45,21 @@ SetOfInstancesJob(serialized), context_(context) { + // we need to rebuild the instancesIds_ and filesInfo_ from the SetOfInstancesJob + GetInstancesIds(instancesIds_); + + for (size_t i = 0; i < instancesIds_.size(); ++i) + { + FileInfo fileInfo; + int64_t revisionNotUsed; + if (!context.GetIndex().LookupAttachment(fileInfo, revisionNotUsed, ResourceType_Instance, instancesIds_[i], FileContentType_Dicom)) + { + throw OrthancException(ErrorCode_UnknownResource, std::string("Error while unserializing a job, unable to find DICOM attachment for instance ") + instancesIds_[i]); + } + + filesInfo_.push_back(fileInfo); + } + } void StoreJob::AddInstances(const std::vector<std::string>& instancesIds, @@ -87,7 +102,8 @@ { if (reason == JobStopReason_Canceled || reason == JobStopReason_Failure || - reason == JobStopReason_Retry) + reason == JobStopReason_Retry || + reason == JobStopReason_Success) { // clear the loader threads if (instancesLoader_.get() != NULL)
--- a/OrthancServer/Sources/ServerJobs/StoreJob.h Mon Mar 30 11:36:16 2026 +0200 +++ b/OrthancServer/Sources/ServerJobs/StoreJob.h Mon Mar 30 12:47:58 2026 +0200 @@ -39,7 +39,6 @@ protected: ServerContext& context_; std::unique_ptr<ThreadedInstancesLoader> instancesLoader_; - // TODO: re-create when unserializing (in AddParentResources ?) std::vector<std::string> instancesIds_; std::vector<FileInfo> filesInfo_;
--- a/TODO Mon Mar 30 11:36:16 2026 +0200 +++ b/TODO Mon Mar 30 12:47:58 2026 +0200 @@ -71,8 +71,6 @@ "admin": { "Password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", "Hashing": "sha1"} } -* Reuse the ThreadedInstanceLoader from the ArchiveJob in C-Store, peer/store ... to optimize loading - time when working with an object storage. ============================
