自定义组件¶
这是一份关于如何构建简单的应用程序和自定义组件规范并通过两个不同的调度器启动它的指南。
请参阅快速入门指南,了解安装和基本用法。
内置¶
在编写自定义组件之前,请检查是否有任何内置组件满足您的需求。TorchX 提供了许多带有预制映像的内置组件。您可以通过以下方式发现它们:
[1]:
%%sh
torchx builtins
Found 11 builtin components:
1. dist.ddp
2. dist.spmd
3. metrics.tensorboard
4. serve.torchserve
5. utils.binary
6. utils.booth
7. utils.copy
8. utils.echo
9. utils.python
10. utils.sh
11. utils.touch
您可以从 CLI、管道或像任何其他组件一样以编程方式使用这些组件。
[2]:
%%sh
torchx run utils.echo --msg "Hello :)"
torchx 2024-10-21 22:54:55 INFO Tracker configurations: {}
torchx 2024-10-21 22:54:55 INFO Checking for changes in workspace `file:///home/runner/work/torchx/torchx/docs/source`...
torchx 2024-10-21 22:54:55 INFO To disable workspaces pass: --workspace="" from CLI or workspace=None programmatically.
torchx 2024-10-21 22:54:55 INFO Workspace `file:///home/runner/work/torchx/torchx/docs/source` resolved to filesystem path `/home/runner/work/torchx/torchx/docs/source`
torchx 2024-10-21 22:57:26 INFO Building workspace docker image (this may take a while)...
torchx 2024-10-21 22:57:26 INFO Step 1/4 : ARG IMAGE
torchx 2024-10-21 22:57:26 INFO Step 2/4 : FROM $IMAGE
torchx 2024-10-21 22:57:26 INFO ---> 151eadd3279c
torchx 2024-10-21 22:57:26 INFO Step 3/4 : COPY . .
torchx 2024-10-21 22:57:33 INFO ---> 141136d3cd5c
torchx 2024-10-21 22:57:33 INFO Step 4/4 : LABEL torchx.pytorch.org/version=0.8.0dev0
torchx 2024-10-21 22:57:33 INFO ---> Running in 826080f9d780
torchx 2024-10-21 22:57:40 INFO ---> Removed intermediate container 826080f9d780
torchx 2024-10-21 22:57:40 INFO ---> ae3d27133aeb
torchx 2024-10-21 22:57:40 INFO [Warning] One or more build-args [WORKSPACE] were not consumed
torchx 2024-10-21 22:57:40 INFO Successfully built ae3d27133aeb
torchx 2024-10-21 22:57:40 INFO Built new image `sha256:ae3d27133aeb61a9b1fefc7a0b850bdf514fb424a002464c8aba42ba82b5912f` based on original image `ghcr.io/pytorch/torchx:0.8.0dev0` and changes in workspace `file:///home/runner/work/torchx/torchx/docs/source` for role[0]=echo.
torchx 2024-10-21 22:57:40 INFO Waiting for the app to finish...
torchx 2024-10-21 22:57:40 INFO Job finished: SUCCEEDED
echo/0 Hello :)
local_docker://torchx/echo-qtqh4pks2p52md
世界您好¶
让我们从编写一个简单的 “Hello World” python 应用程序开始。这只是一个普通的 python 程序,可以包含您想要的任何内容。
注意
此示例使用 Jupyter Notebook 创建本地文件以用于示例目的。在正常使用情况下,您可以将这些文件作为独立文件。%%writefile
[3]:
%%writefile my_app.py
import sys
import argparse
def main(user: str) -> None:
print(f"Hello, {user}!")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Hello world app"
)
parser.add_argument(
"--user",
type=str,
help="the person to greet",
required=True,
)
args = parser.parse_args(sys.argv[1:])
main(args.user)
Writing my_app.py
现在我们有一个应用程序,我们可以为它编写组件文件。此功能允许我们以用户友好的方式重用和共享我们的应用程序。
我们可以从 cli 或以编程方式将此组件用作管道的一部分。torchx
[4]:
%%writefile my_component.py
import torchx.specs as specs
def greet(user: str, image: str = "my_app:latest") -> specs.AppDef:
return specs.AppDef(
name="hello_world",
roles=[
specs.Role(
name="greeter",
image=image,
entrypoint="python",
args=[
"-m", "my_app",
"--user", user,
],
)
],
)
Writing my_component.py
我们可以通过 .调度程序相对于当前目录执行组件。torchx run
local_cwd
[5]:
%%sh
torchx run --scheduler local_cwd my_component.py:greet --user "your name"
torchx 2024-10-21 22:57:41 INFO Tracker configurations: {}
torchx 2024-10-21 22:57:41 INFO Log directory not set in scheduler cfg. Creating a temporary log dir that will be deleted on exit. To preserve log directory set the `log_dir` cfg option
torchx 2024-10-21 22:57:41 INFO Log directory is: /tmp/torchx_19lvnw6c
torchx 2024-10-21 22:57:41 INFO Waiting for the app to finish...
greeter/0 Hello, your name!
torchx 2024-10-21 22:57:42 INFO Job finished: SUCCEEDED
local_cwd://torchx/hello_world-cc55h2cs2rwtf
如果我们想在其他环境中运行,我们可以构建一个 Docker 容器,这样我们就可以在支持 Docker 的环境(如 Kubernetes)中或通过本地 Docker 调度器运行我们的组件。
注意
这需要安装 Docker,并且在 Google Colab 等环境中不起作用。如果您尚未按照以下安装说明进行作:https://docs.docker.com/get-docker/
[6]:
%%writefile Dockerfile.custom
FROM ghcr.io/pytorch/torchx:0.1.0rc1
ADD my_app.py .
Writing Dockerfile.custom
创建 Dockerfile 后,我们就可以创建 Docker 映像了。
[7]:
%%sh
docker build -t my_app:latest -f Dockerfile.custom .
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile.custom
#1 transferring dockerfile: 99B done
#1 DONE 0.0s
#2 [internal] load metadata for ghcr.io/pytorch/torchx:0.1.0rc1
#2 DONE 0.2s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [internal] load build context
#4 transferring context: 425B done
#4 DONE 0.0s
#5 [1/2] FROM ghcr.io/pytorch/torchx:0.1.0rc1@sha256:a738949601d82e7f100fa1efeb8dde0c35ce44c66726cf38596f96d78dcd7ad3
#5 resolve ghcr.io/pytorch/torchx:0.1.0rc1@sha256:a738949601d82e7f100fa1efeb8dde0c35ce44c66726cf38596f96d78dcd7ad3 done
#5 sha256:d2e110be24e168b42c1a2ddbc4a476a217b73cccdba69cdcb212b812a88f5726 857B / 857B 0.1s done
#5 sha256:889a7173dcfeb409f9d88054a97ab2445f5a799a823f719a5573365ee3662b6f 189B / 189B 0.0s done
#5 sha256:6009a622672af862e3a3979ffd58a348f95208a4bc3b6f6cea2efda4e8390203 0B / 9.94MB 0.1s
#5 sha256:a738949601d82e7f100fa1efeb8dde0c35ce44c66726cf38596f96d78dcd7ad3 3.25kB / 3.25kB done
#5 sha256:4bbfd2c87b7524455f144a03bf387c88b6d4200e5e0df9139a9d5e79110f89ca 0B / 26.70MB 0.1s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 0B / 2.00GB 0.1s
#5 sha256:3dbec59e804974689ff0739216fb012d3e1cd6694632cd3a85b74b572266ec5c 7.21kB / 7.21kB done
#5 sha256:6009a622672af862e3a3979ffd58a348f95208a4bc3b6f6cea2efda4e8390203 9.94MB / 9.94MB 0.2s done
#5 sha256:4bbfd2c87b7524455f144a03bf387c88b6d4200e5e0df9139a9d5e79110f89ca 16.78MB / 26.70MB 0.3s
#5 sha256:d4c7af0d4fa735e6727a24afcea4022492c7f29ac85e31ddf3d385bfbf704f71 0B / 21.46MB 0.3s
#5 sha256:eccbe17c44e1b27c836dddc42f204bde06f73568b50833556b50324146bd43aa 132B / 132B 0.3s done
#5 sha256:4bbfd2c87b7524455f144a03bf387c88b6d4200e5e0df9139a9d5e79110f89ca 26.70MB / 26.70MB 0.4s done
#5 sha256:d4c7af0d4fa735e6727a24afcea4022492c7f29ac85e31ddf3d385bfbf704f71 5.37MB / 21.46MB 0.4s
#5 extracting sha256:4bbfd2c87b7524455f144a03bf387c88b6d4200e5e0df9139a9d5e79110f89ca
#5 sha256:06b5edd6bf524455a7c5a54cb27ced3ecc540414ecf38c24c80ba4368ebc77de 0B / 257B 0.4s
#5 sha256:d4c7af0d4fa735e6727a24afcea4022492c7f29ac85e31ddf3d385bfbf704f71 21.46MB / 21.46MB 0.5s done
#5 sha256:06b5edd6bf524455a7c5a54cb27ced3ecc540414ecf38c24c80ba4368ebc77de 257B / 257B 0.4s done
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 0B / 1.71GB 0.5s
#5 sha256:c0ad16d9fa05dbf708784e8aa10d69153465bae391345020be52cbe0a1701932 0B / 92B 0.5s
#5 sha256:c0ad16d9fa05dbf708784e8aa10d69153465bae391345020be52cbe0a1701932 92B / 92B 0.5s done
#5 sha256:30587ba7fd6bcbd1c883125d84517055b2d7f2d35a13faedbc8b15f94b900cc2 352B / 352B 0.6s done
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 0B / 341.29MB 0.6s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 127.93MB / 2.00GB 0.9s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 33.55MB / 341.29MB 0.9s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 57.67MB / 341.29MB 1.1s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 104.86MB / 1.71GB 1.3s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 92.27MB / 341.29MB 1.3s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 247.51MB / 2.00GB 1.4s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 115.34MB / 341.29MB 1.4s
#5 extracting sha256:4bbfd2c87b7524455f144a03bf387c88b6d4200e5e0df9139a9d5e79110f89ca 1.3s done
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 144.70MB / 341.29MB 1.6s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 178.26MB / 341.29MB 1.8s
#5 extracting sha256:d2e110be24e168b42c1a2ddbc4a476a217b73cccdba69cdcb212b812a88f5726 done
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 348.13MB / 2.00GB 2.0s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 203.42MB / 1.71GB 2.0s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 213.91MB / 341.29MB 2.0s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 235.93MB / 341.29MB 2.1s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 271.58MB / 341.29MB 2.3s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 289.48MB / 1.71GB 2.5s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 290.46MB / 341.29MB 2.5s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 476.05MB / 2.00GB 2.8s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 341.29MB / 341.29MB 2.8s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 377.49MB / 1.71GB 3.0s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 584.06MB / 2.00GB 3.5s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 469.76MB / 1.71GB 3.7s
#5 sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 341.29MB / 341.29MB 3.8s done
#5 sha256:f119a6d0a466a041afbcb08344ff624b5c5ac5f68b93d33af4827529ea1a6800 563.38kB / 563.38kB 3.9s done
#5 sha256:88d87059c913e67971846680d4032b75f96f599f8a67062f668fed6471fc2968 0B / 556.96kB 3.9s
#5 sha256:88d87059c913e67971846680d4032b75f96f599f8a67062f668fed6471fc2968 556.96kB / 556.96kB 4.0s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 706.74MB / 2.00GB 4.2s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 591.40MB / 1.71GB 4.4s
#5 sha256:88d87059c913e67971846680d4032b75f96f599f8a67062f668fed6471fc2968 556.96kB / 556.96kB 4.1s done
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 817.89MB / 2.00GB 4.8s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 695.87MB / 1.71GB 4.9s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 956.30MB / 2.00GB 5.5s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 809.50MB / 1.71GB 5.5s
#5 extracting sha256:889a7173dcfeb409f9d88054a97ab2445f5a799a823f719a5573365ee3662b6f done
#5 extracting sha256:6009a622672af862e3a3979ffd58a348f95208a4bc3b6f6cea2efda4e8390203
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.10GB / 2.00GB 6.4s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 955.25MB / 1.71GB 6.4s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.04GB / 1.71GB 7.0s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.20GB / 2.00GB 7.3s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.15GB / 1.71GB 7.7s
#5 extracting sha256:6009a622672af862e3a3979ffd58a348f95208a4bc3b6f6cea2efda4e8390203 1.8s done
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.34GB / 2.00GB 7.9s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.27GB / 1.71GB 8.1s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.45GB / 2.00GB 8.7s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.38GB / 1.71GB 8.7s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.47GB / 1.71GB 9.5s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.56GB / 2.00GB 9.6s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.57GB / 1.71GB 10.0s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.67GB / 2.00GB 10.2s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.67GB / 1.71GB 10.5s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.78GB / 2.00GB 10.8s
#5 sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 1.71GB / 1.71GB 11.1s done
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.88GB / 2.00GB 11.4s
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 1.98GB / 2.00GB 12.0s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907
#5 sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 2.00GB / 2.00GB 13.1s done
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 5.1s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 10.1s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 15.1s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 20.1s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 25.2s
#5 extracting sha256:143f801954310499daa44a8499a49797d2f282b5d56be601557ebe6cbf796907 30.1s done
#5 extracting sha256:eccbe17c44e1b27c836dddc42f204bde06f73568b50833556b50324146bd43aa
#5 extracting sha256:eccbe17c44e1b27c836dddc42f204bde06f73568b50833556b50324146bd43aa done
#5 extracting sha256:d4c7af0d4fa735e6727a24afcea4022492c7f29ac85e31ddf3d385bfbf704f71 0.1s
#5 extracting sha256:d4c7af0d4fa735e6727a24afcea4022492c7f29ac85e31ddf3d385bfbf704f71 0.7s done
#5 extracting sha256:06b5edd6bf524455a7c5a54cb27ced3ecc540414ecf38c24c80ba4368ebc77de
#5 extracting sha256:06b5edd6bf524455a7c5a54cb27ced3ecc540414ecf38c24c80ba4368ebc77de done
#5 extracting sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 0.1s
#5 extracting sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 5.2s
#5 extracting sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 10.3s
#5 extracting sha256:f18d016c4ccc1c57c9e34cb119e1e1966287b08aa9b4d52a38b30815a56574b6 15.1s done
#5 extracting sha256:c0ad16d9fa05dbf708784e8aa10d69153465bae391345020be52cbe0a1701932 done
#5 extracting sha256:30587ba7fd6bcbd1c883125d84517055b2d7f2d35a13faedbc8b15f94b900cc2
#5 extracting sha256:30587ba7fd6bcbd1c883125d84517055b2d7f2d35a13faedbc8b15f94b900cc2 done
#5 extracting sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 0.1s
#5 extracting sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 5.3s
#5 extracting sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 10.3s
#5 extracting sha256:909695be1d5003de345714eec2ca3020a48dd8f407fe918cbd47a8db73d7a233 13.4s done
#5 extracting sha256:f119a6d0a466a041afbcb08344ff624b5c5ac5f68b93d33af4827529ea1a6800
#5 extracting sha256:f119a6d0a466a041afbcb08344ff624b5c5ac5f68b93d33af4827529ea1a6800 0.0s done
#5 extracting sha256:88d87059c913e67971846680d4032b75f96f599f8a67062f668fed6471fc2968
#5 extracting sha256:88d87059c913e67971846680d4032b75f96f599f8a67062f668fed6471fc2968 0.0s done
#5 DONE 80.4s
#6 [2/2] ADD my_app.py .
#6 DONE 0.0s
#7 exporting to image
#7 exporting layers
#7 exporting layers 4.1s done
#7 writing image sha256:aa3d79a92d0eb6ee03cad7fb54428e68728fa625029b9150d68727b5798039ae done
#7 naming to docker.io/library/my_app:latest done
#7 DONE 4.1s
然后,我们可以在本地调度器上启动它。
[8]:
%%sh
torchx run --scheduler local_docker my_component.py:greet --image "my_app:latest" --user "your name"
torchx 2024-10-21 22:59:13 INFO Tracker configurations: {}
torchx 2024-10-21 22:59:13 INFO Checking for changes in workspace `file:///home/runner/work/torchx/torchx/docs/source`...
torchx 2024-10-21 22:59:13 INFO To disable workspaces pass: --workspace="" from CLI or workspace=None programmatically.
torchx 2024-10-21 22:59:13 INFO Workspace `file:///home/runner/work/torchx/torchx/docs/source` resolved to filesystem path `/home/runner/work/torchx/torchx/docs/source`
torchx 2024-10-21 22:59:13 WARNING failed to pull image my_app:latest, falling back to local: 404 Client Error for http+docker://localhost/v1.45/images/create?tag=latest&fromImage=my_app: Not Found ("pull access denied for my_app, repository does not exist or may require 'docker login': denied: requested access to the resource is denied")
torchx 2024-10-21 22:59:13 INFO Building workspace docker image (this may take a while)...
torchx 2024-10-21 22:59:13 INFO Step 1/4 : ARG IMAGE
torchx 2024-10-21 22:59:13 INFO Step 2/4 : FROM $IMAGE
torchx 2024-10-21 22:59:13 INFO ---> aa3d79a92d0e
torchx 2024-10-21 22:59:13 INFO Step 3/4 : COPY . .
torchx 2024-10-21 22:59:18 INFO ---> 0218f2550709
torchx 2024-10-21 22:59:18 INFO Step 4/4 : LABEL torchx.pytorch.org/version=0.8.0dev0
torchx 2024-10-21 22:59:18 INFO ---> Running in 5298a9cc7379
torchx 2024-10-21 22:59:22 INFO ---> Removed intermediate container 5298a9cc7379
torchx 2024-10-21 22:59:22 INFO ---> d99edb8e1972
torchx 2024-10-21 22:59:22 INFO [Warning] One or more build-args [WORKSPACE] were not consumed
torchx 2024-10-21 22:59:22 INFO Successfully built d99edb8e1972
torchx 2024-10-21 22:59:22 INFO Built new image `sha256:d99edb8e1972605584cdefdd54cd8c213071f9f158bc2d9057164aaf0853e050` based on original image `my_app:latest` and changes in workspace `file:///home/runner/work/torchx/torchx/docs/source` for role[0]=greeter.
torchx 2024-10-21 22:59:22 INFO Waiting for the app to finish...
greeter/0 Hello, your name!
torchx 2024-10-21 22:59:23 INFO Job finished: SUCCEEDED
local_docker://torchx/hello_world-hpl9hwcbw07s0c
如果您有 Kubernetes 集群,则可以使用 Kubernetes 调度程序在集群上启动它。
$ docker push my_app:latest
$ torchx run --scheduler kubernetes my_component.py:greet --image "my_app:latest" --user "your name"