Google Cloud Dataflow VM上的jstack和其他工具
问题描述:
是否可以在为Dataflow作业创建的VM上运行jstack? 我试图查看作业在哪里花费了大部分CPU时间,却找不到安装它的地方.
Is there a way to run jstack on the VMs created for Dataflow jobs? I'm trying to see where the job spends most of the CPU time and I can't find it installed.
谢谢, G
答
我发现可以解决的变通方法:
A workaround which I found to work:
- 登录计算机
- 使用
sudo docker ps
查找运行"python -m taskrunne"的Docker容器
- 使用
sudo docker exec -i -t 9da88780f555 bash
连接到容器(将容器ID替换为步骤2中找到的ID) - 使用
apt-get install openjdk-7-jdk
安装openjdk-7-jdk
- 找到Java可执行文件的进程ID
- 运行
/usr/bin/jstack 1437
- Log on to the machine
- Find the docker container that runs "python -m taskrunne" using
sudo docker ps
- Connect to the container using
sudo docker exec -i -t 9da88780f555 bash
(replacing the container id with the one found in step 2) - Install openjdk-7-jdk using
apt-get install openjdk-7-jdk
- Find the process id of the java executable
- Run
/usr/bin/jstack 1437