@@ -25,7 +25,7 @@ class RuntimeCommandBase(CommandBase):
25
25
om runtime log [-f] [options]
26
26
om runtime status [workers|labels|stats] [options]
27
27
om runtime restart app <name> [--insecure] [--apphub-url=<url>] [options]
28
- om runtime serve [<rule>...] [--rules=<rulefile>] [options]
28
+ om runtime serve [<rule>...] [--rules=<rulefile>] [--port=<port>] [--ip=<ip>] [ options]
29
29
om runtime deploy [<deploy-action>] [--steps=<deployfile>] [--specs=<specs>] [--select=<filter>] [--dry] [options]
30
30
om runtime (control|inspect|celery) [<celery-command>...] [--worker=<worker>] [--queue=<queue>] [--celery-help] [--flags <celery-flags>] [options]
31
31
om runtime (export|import) [<prefix/name>...] [--path=<path>] [--compress] [--list] [--promote] [options]
@@ -45,6 +45,8 @@ class RuntimeCommandBase(CommandBase):
45
45
--rules=VALUE /path/to/specs.txt, where each line is a <spec>
46
46
--compress if specified the archive will be compress (tgz format) [default: True]
47
47
--path=PATH path to directory where the archive should be written [default: ./mlops-export]
48
+ --port=VALUE the port to use for the server [default: 8000]
49
+ --ip=VALUE the ip to use for the server [default: localhost]
48
50
--list if specified, print members of archive
49
51
--promote if specified, import and promote objects
50
52
--steps=VALUE /path/to/deployfile.yaml [default: ./deployfile.yaml]
@@ -429,11 +431,13 @@ def serve(self):
429
431
om = get_omega (self .args , require_config = False )
430
432
specs = self .args .get ('<rule>' )
431
433
specfile = self .args .get ('--rules' )
434
+ port = self .args .get ('--port' , 8000 )
435
+ host = self .args .get ('--host' , 'localhost' )
432
436
if specfile :
433
437
with open (specfile , 'r' ) as fin :
434
438
specs = [s .replace ('\n ' , '' ) for s in fin .readlines () if not s .startswith ('#' )]
435
439
os .environ ['OMEGA_RESTAPI_FILTER' ] = ';' .join (specs ) if specs else om .defaults .OMEGA_RESTAPI_FILTER
436
- subprocess .run ("gunicorn 'omegaml.restapi.app:serve_objects()'" , shell = True )
440
+ subprocess .run (f "gunicorn 'omegaml.restapi.app:serve_objects()' --bind { host } : { port } " , shell = True )
437
441
438
442
def deploy (self ):
439
443
om = get_omega (self .args , require_config = False )
0 commit comments