File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 140140 "start" : {
141141 "type" : " array" ,
142142 "description" : " Specify commands to run to start your application (Python only)"
143+ },
144+ "admin_port" : {
145+ "type" : " number" ,
146+ "description" : " The port number of the admin server (Default: 3001)"
143147 }
144148 }
145149 },
Original file line number Diff line number Diff line change @@ -348,7 +348,10 @@ def _launch(self) -> None:
348348 self ._executor_field = ThreadPoolExecutor (max_workers = 64 )
349349 self ._sys_db_field = SystemDatabase (self .config )
350350 self ._app_db_field = ApplicationDatabase (self .config )
351- self ._admin_server_field = AdminServer (dbos = self )
351+ admin_port = self .config ["runtimeConfig" ].get ("admin_port" )
352+ if admin_port is None :
353+ admin_port = 3001
354+ self ._admin_server_field = AdminServer (dbos = self , port = admin_port )
352355
353356 if not os .environ .get ("DBOS__VMID" ):
354357 workflow_ids = self ._sys_db .get_pending_workflows ("local" )
Original file line number Diff line number Diff line change 1414
1515class RuntimeConfig (TypedDict , total = False ):
1616 start : List [str ]
17+ admin_port : Optional [int ]
1718
1819
1920class DatabaseConfig (TypedDict , total = False ):
Original file line number Diff line number Diff line change @@ -123,3 +123,39 @@ def test_step(var2: str) -> str:
123123 time .sleep (1 )
124124 print (f"Attempt { attempt + 1 } failed. Retrying in 1 second..." )
125125 assert succeeded , "Workflow did not recover"
126+
127+
128+ def test_admin_diff_port (cleanup_test_databases : None ) -> None :
129+ # Initialize singleton
130+ DBOS .destroy () # In case of other tests leaving it
131+
132+ config_string = """name: test-app
133+ language: python
134+ database:
135+ hostname: localhost
136+ port: 5432
137+ username: postgres
138+ password: ${PGPASSWORD}
139+ app_db_name: dbostestpy
140+ runtimeConfig:
141+ start:
142+ - python3 main.py
143+ admin_port: 8001
144+ """
145+ # Write the config to a text file for the moment
146+ with open ("dbos-config.yaml" , "w" ) as file :
147+ file .write (config_string )
148+
149+ try :
150+ # Initialize DBOS
151+ DBOS ()
152+ DBOS .launch ()
153+
154+ # Test GET /dbos-healthz
155+ response = requests .get ("http://localhost:8001/dbos-healthz" , timeout = 5 )
156+ assert response .status_code == 200
157+ assert response .text == "healthy"
158+ finally :
159+ # Clean up after the test
160+ DBOS .destroy ()
161+ os .remove ("dbos-config.yaml" )
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ def test_valid_config(mocker):
3232 runtimeConfig:
3333 start:
3434 - "python3 main.py"
35+ admin_port: 8001
3536 database:
3637 hostname: 'some host'
3738 port: 1234
You can’t perform that action at this time.
0 commit comments