39 Commits

Author SHA1 Message Date
Martin-Molinero cd52034ddf Skip object store folder creation when no storage access (#9634)
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
LocalObjectStore.Initialize created the storage root directory
unconditionally, before Controls were even assigned. On environments
where the process lacks permission to the target path this threw an
UnauthorizedAccessException even for jobs with no storage access at all.

Now Controls are assigned first and the root directory is only created
when StorageAccess is null or grants at least one of read/write/delete,
matching the permission checks already guarding every disk operation.
When access is fully denied the path is still normalized via
Path.GetFullPath so later comparisons remain consistent.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 15:59:55 -03:00
JosueNina 9c7d633b41 Throw exceptions when ObjectStore limits are exceeded in Research mode (#9060)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Throw exception in Research mode when storage limits are exceeded

* Solve review comments
2025-10-27 10:16:25 -05:00
JosueNina 49fe020b84 Add ObjectStore limit properties (#9043)
* Initial solution

* Add Unit tests

* Solve review comments

* Fix broken tests

* Solve review comments

* Updated property names
2025-10-20 17:21:31 -03:00
Martin-Molinero e9c15b2806 Minor refactor to use lazy timer schedling (#9027)
- RateGate, TimeMonitor and ObjectStore won't schedule timer unless
  required
2025-10-13 09:21:27 -03:00
Martin-Molinero cffd20236c Object store dispose hang (#8925)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
2025-08-13 18:18:48 -03:00
Jhonathan Abreu 2e9cc39c89 Rename Controls.StoragePermission -> Controls.StorageAccess (#8862)
* Refactor Controls.StoragePermissions format for the API

* Minor changes

* Rename Controls.StoragePermission -> Controls.StorageAccess

* Minor fix
2025-07-09 11:11:27 -04:00
Martin-Molinero 99558928f0 Improve ObjectStore root config handling (#8445)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
2024-12-04 19:17:10 -03:00
Martin-Molinero 9c1824cccf Enhance GetFilePath subdirectory handling (#8057)
- GetFilePath will create subdirectories assuming the last piece of the
  requested path is a leaf. Expanding unit tests
2024-05-24 18:27:57 -03:00
Martin-Molinero 67b9ecf391 Minor config tweaks (#7792)
Benchmarks / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
2024-02-19 12:05:00 -03:00
Ricardo Andrés Marino Rojas 0f47ba657d Solve race condition bug in LocalObjectStore (#7645)
* Solve bug and add unit tests

The bug was raised due to a race condition when writing a file and
deleting it. In order to stop it, a check condition was added at the end
of the PersistData() method to remove files that have just been deleted.

* Nit changes

* Add a different constructor for the test
2023-12-27 19:18:02 -03:00
Martin-Molinero 4ca5526461 Refactor object store file handling (#7438)
- Add FileHandler for local object store file operations
2023-08-21 10:11:07 -03:00
Martin-Molinero c4329c4132 More resilient object store file read (#6800)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
2022-12-13 15:25:47 -03:00
Martin-Molinero 62d1321d74 Object Store Limit Validation (#6726)
- Minor object store limit validation on saving a new entry
2022-11-08 11:51:16 -03:00
Martin-Molinero dc4a903727 Fix ObjectStore limits enforcement (#6609)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
- Fix object store limits enforcement. Adding unit tests
2022-09-01 13:52:11 -03:00
Martin-Molinero fcd48ecdbb Object Store Improvements (#6605)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
- Fix for cache behavior, finer grained writting and loading
- Add Keys and Clear to the object store API. Adding tests
2022-08-31 20:50:00 -03:00
Martin-Molinero 46aa62bd0c Improve object store key support (#6598)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
2022-08-30 18:18:50 -03:00
Martin-Molinero 250230e79f Global object store (#6594)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* Refactor object store

* Address reviews

* Simplify implementation

- Remove base64 encoding
- Refactor object store api to allow a single path argument

* Fix bug

* Adjust storage controls

* Fix unit tests
2022-08-30 16:40:01 -03:00
Martin-Molinero cb2062debd Expand GetSecondUnevenWait usages (#6340)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* Reduce Live CPU usage

* Address selfreview
2022-05-16 20:12:22 -03:00
Martin-Molinero 06c05c4274 Fully reset security cache (#6277)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
- Fully reset the security cache when it's finally removed from the algorithm.
   Adding regression algorithm reproducing issue
- Updating regression algorithms which would trade based on data
  previously available
2022-04-01 15:00:29 -03:00
Ricardo Andrés Marino Rojas a675aca7e5 Refactor GetFilePath() (#6164)
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
* Refactor `GetFilePath()`
Add also useful methods to use with this one

* Nit changes

* Requested changes

* Requested changes

* Restore SaveString()

* Nit changes

* Address self review

* Test improvements

* Adjust example KerasNeuralNetworkAlgorithm

* Minor tweak for KerasNeuralNetworkAlgorithm.py

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2022-02-04 16:58:25 -03:00
Martin-Molinero 1fdb36ee89 Improve object store logs (#5864)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
2021-08-18 10:33:34 -03:00
Rohan Sharma 8d352b6318 feat: Improve error message from ObjectStore (#5729) 2021-07-02 10:37:37 -03:00
Jasper van Merle c333ccdc4a Check whether storage directory exists before enumerating it (#5432) 2021-03-29 13:32:28 -07:00
Colton Sellers 76a53eb096 Local Object Store Refactor and Fixes (#4880)
* Store temp files in subdirectory

* Fix Dispose case for new temp dir

* Adjust tests for new temp dir

* Dispose unit tests

* Unit test for issue 4811

* Refactor for not using temp files

* Fix storage checks for saving data, plus tests

* Use Base64 for storing keys and decoding them; handles odd key strings

* Don't allow "?" in a key

* Address review

* Deleted test cases

* PersistData handle deletion of files

* Refactor GetFilePath to use Persist()

* Make PathForKey protected
2020-10-30 21:36:23 -03:00
Martin-Molinero 79b9009452 ObjectStore delete will delete file (#4816)
- LocalObjectStore.Delete() will also delete file from the local object
  store path if present, this will avoid the issue where restarting the
  object store will re load the same deleted file. Adding unit test.
  Issue https://github.com/QuantConnect/Lean/issues/4811
2020-10-05 20:19:27 -03:00
Colton Sellers b8674731a5 Feature 2456 custom Python consolidator support (#4637)
* DataConsolidator Wrapper for Python Consolidators

* Regression Unit Test

* Refactor Regression test

* Bad test fix

* pre review

* self review

* Add RegisterIndicator for Python Consolidator

* Python base class for consolidators

* Modify regression algo to register indicator

* unit test - attach event

* Test fix

* Fix test python imports

* Add license header file and null check

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
2020-08-25 17:26:55 -03:00
Martin Molinero e217caef47 Adding null checks for failed initializations
- Adding null checks to handle failed algorithm initializations
2020-07-08 10:18:43 -03:00
Martin Molinero 35f849254e Improvements
- Replace bitwise And operation for .HasFlag call
- Minor change in object store permission error message
2020-06-09 20:55:21 -03:00
Martin Molinero 7a7ad8e7e7 Address review: improve error messaging 2020-06-09 19:29:59 -03:00
Martin Molinero e782ffa4c6 Reuse existing FileAccess permissions 2020-06-09 18:13:12 -03:00
Martin Molinero 5bd11ebd9d Add permission control for Storage
- Adding `Controls.StoragePermissions` to govern permissions for storing into
  the object store. Adding unit tests
2020-06-09 17:24:00 -03:00
Martin Molinero f86af05227 Fix for ObjectStore for QuantBook 2020-04-29 21:03:35 -03:00
Jared aa2f875045 Merge pull request #3962 from QuantConnect/bug-3961-remove-ltrh-unnecessary-call-touniversaltime
Remove ToUniversalTime - Fix LocalObjectStore limit
2020-01-02 13:57:17 -08:00
Martin Molinero 24a3c24f55 Remove ToUniversalTime. Fix LocalObjectStore limit
- Removing unnecessary call to `ToUniversalTime()` in the LTRH
- Fix bug in the `LocalObjectStore` limit check. Adding unit test
2020-01-02 15:33:41 -03:00
Michael Handschuh 39935552a3 Convert ObjectStore ext class to implement IObjectStore for API
Since extension methods don't play well with pythonnet, this change converts
the extensions class into a decorator class. Additionally, this ObjectStore
type is the type that gets exposed via QCAlgorithm so users can access these
methods directly without requiring the use of extension methods.

This approach has many good properties. For one, it doesn't force implementors
of IObjectStore to use a base class. Second, it maintains healthy separation of
API level concerns (such as convenient methods) from the  abstraction level conerns
of IObjectStore. Setting it up in this way ensures ANY implementation of IObjectStore
will still get access to these additional methods. Another thing to note is this
prevents using a base class on QCAlgorithm's public interface. Instead, we have a
specific type that is dedicated to fulfilling API level requirements, which also
provides us flexibility in the event the API needs to be updated. If it were a subclass,
you run the risk of breaking the implementors of the subclass.
2019-12-31 15:55:16 -05:00
Jared 683250ffd3 Flip order of raising event and log to ensure log.
Prevent exception in error handler dropping the log.
2019-12-18 09:55:17 -08:00
Michael Handschuh 5bda58dfd1 Initialize LocalObjectStore
Seed the LocalObjectStore with files read from the local disk on Initialize
2019-12-18 08:42:04 -05:00
Michael Handschuh 999cc275b6 Add IObjectStore.ErrorRaised for persistence errors
Errors raised during persistence aren't able to be handled by user code,
and in fact, are swallowed by the implementation after being logged. By
exposing these errors as events we allow the algorithm to be notified of
such an error and take any step necessary to handle the persistence error.
2019-12-17 22:58:27 -05:00
Michael Handschuh 3de807fd05 Move LocalObjectStore to Lean.Engine
There's no reason for algorithms to have direct access to this implementation.
Moving this into the engine prevents algoriths from directly accessing LocalObjectStore
and instead can only reference it through the IObjectStore abstraction
2019-12-17 22:21:11 -05:00