Best Python code snippet using dbt-osmosis_python
server_v2.py
Source: server_v2.py
...333 data=init_err.__dict__,334 )335 )336 loop = asyncio.get_running_loop()337 project.heartbeat = loop.create_task(_adapter_heartbeat(project))338 return OsmosisRegisterResult(added=x_dbt_project, projects=dbt.registered_projects())339@app.post(340 "/unregister",341 responses={status.HTTP_404_NOT_FOUND: {"model": OsmosisErrorContainer}},342)343async def unregister(344 response: Response,345 x_dbt_project: str = Header(),346) -> Union[OsmosisResetResult, OsmosisErrorContainer]:347 """Unregister a project. This drop a project from memory"""348 dbt: DbtProjectContainer = app.state.dbt_project_container349 project = dbt.get_project(x_dbt_project)350 if project is None:351 response.status_code = status.HTTP_404_NOT_FOUND352 return OsmosisErrorContainer(353 error=OsmosisError(354 code=OsmosisErrorCode.ProjectNotRegistered,355 message="Project is not registered. Make a POST request to the /register endpoint first to register a runner",356 data={"registered_projects": dbt.registered_projects()},357 )358 )359 project.heartbeat.cancel()360 dbt.drop_project(project)361 return OsmosisUnregisterResult(removed=project, projects=dbt.registered_projects())362@app.get("/health")363async def health_check(364 x_dbt_project: str = Header(default=DEFAULT),365) -> dict:366 """Checks if the server is running and accepting requests367 TODO: We will likely iterate on this, it is mostly for368 kubernetes liveness probes"""369 dbt: DbtProjectContainer = app.state.dbt_project_container370 if x_dbt_project == DEFAULT:371 project = dbt.get_default_project()372 else:373 project = dbt.get_project(x_dbt_project)374 return {375 "result": {376 "status": "ready",377 **(378 {379 "project_name": project.config.project_name,380 "target_name": project.config.target_name,381 "profile_name": project.config.profile_name,382 "logs": project.config.log_path,383 "runner_parse_iteration": project._version,384 "adapter_ready": project.adapter_probe(),385 }386 if project is not None387 else {}388 ),389 "timestamp": datetime.datetime.utcnow(),390 "error": None,391 },392 "dbt-osmosis-server": __name__,393 }394async def _adapter_heartbeat(runner: DbtProject):395 """Equivalent of a keepalive for adapters such as Snowflake"""396 await asyncio.sleep(60 * 30)397 while runner.adapter_probe():398 await asyncio.sleep(60 * 30)399def run_server(host="localhost", port=8581):400 uvicorn.run(401 "dbt_osmosis.core.server_v2:app",402 host=host,403 port=port,404 log_level="info",405 reload=False,406 workers=1,407 )408def test_server():...
Check out the latest blogs from LambdaTest on this topic:
Building a website is all about keeping the user experience in mind. Ultimately, it’s about providing visitors with a mind-blowing experience so they’ll keep coming back. One way to ensure visitors have a great time on your site is to add some eye-catching text or image animations.
When most firms employed a waterfall development model, it was widely joked about in the industry that Google kept its products in beta forever. Google has been a pioneer in making the case for in-production testing. Traditionally, before a build could go live, a tester was responsible for testing all scenarios, both defined and extempore, in a testing environment. However, this concept is evolving on multiple fronts today. For example, the tester is no longer testing alone. Developers, designers, build engineers, other stakeholders, and end users, both inside and outside the product team, are testing the product and providing feedback.
Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.
In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!