mirror of
https://github.com/clearml/clearml
synced 2025-06-26 18:16:07 +00:00
Add Python Fire support (#550)
This commit is contained in:
committed by
GitHub
parent
9794135aed
commit
296cb7d899
22
examples/frameworks/fire/fire_multi_cmd.py
Normal file
22
examples/frameworks/fire/fire_multi_cmd.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# ClearML - Example of Python Fire integration, processing multiple commands, when fire is initialized with no component
|
||||
#
|
||||
from clearml import Task
|
||||
|
||||
import fire
|
||||
|
||||
|
||||
def hello(count, name="clearml", prefix="prefix_", suffix="_suffix", **kwargs):
|
||||
for _ in range(count):
|
||||
print("Hello %s%s%s!" % (prefix, name, suffix))
|
||||
|
||||
|
||||
def serve(addr, port, should_serve=False):
|
||||
if not should_serve:
|
||||
print("Not serving")
|
||||
else:
|
||||
print("Serving on %s:%s" % (addr, port))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Task.init(project_name="examples", task_name="fire multi command")
|
||||
fire.Fire()
|
||||
Reference in New Issue
Block a user