spiff-arena/spiffworkflow-backend/bin/start_blocking_appscheduler.py
dependabot[bot] 4a373be939
Bump black from 23.1.0 to 24.3.0 (#1285)
* Bump black from 23.1.0 to 24.3.0

Bumps [black](https://github.com/psf/black) from 23.1.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/23.1.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed pre commit black issues w/ burnettk

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
2024-03-27 14:05:49 -04:00

33 lines
1.1 KiB
Python
Executable File

"""Start the appscheduler in blocking mode."""
import time
from apscheduler.schedulers.background import BlockingScheduler # type: ignore
from spiffworkflow_backend import create_app
from spiffworkflow_backend.background_processing.apscheduler import start_apscheduler
from spiffworkflow_backend.data_migrations.version_1_3 import VersionOneThree
from spiffworkflow_backend.helpers.db_helper import try_to_connect
def main() -> None:
seconds_to_wait = 300
print(f"sleeping for {seconds_to_wait} seconds to give the api container time to run the migration")
time.sleep(seconds_to_wait)
print("done sleeping")
print("running data migration from background processor")
app = create_app()
start_time = time.time()
with app.app_context():
try_to_connect(start_time)
VersionOneThree().run()
end_time = time.time()
print(f"done running data migration from background processor. took {end_time - start_time} seconds. starting scheduler")
start_apscheduler(app, BlockingScheduler)
if __name__ == "__main__":
main()