7/04/27 10:50:17 INFO Master: Driver submitted org.apache.spark.deploy.worker.DriverWrapper
17/04/27 10:50:17 INFO Master: Launching driver driver-20170427105017-0000 on worker worker-20170427103840-192.168.5.242-7078
17/04/27 10:50:22 INFO Master: 192.168.5.5:53156 got disassociated, removing it.
17/04/27 10:50:22 INFO Master: 192.168.5.5:37668 got disassociated, removing it.
17/04/27 10:50:22 INFO Master: 192.168.5.5:53154 got disassociated, removing it.
17/04/27 10:55:27 INFO Master: Registering app ETL DataPipeline App
17/04/27 10:55:27 INFO Master: Registered app ETL DataPipeline App with ID app-20170427105527-0000
17/04/27 10:55:27 INFO Master: Launching executor app-20170427105527-0000/0 on worker worker-20170427103842-192.168.5.175-7078
17/04/27 10:55:27 INFO Master: Launching executor app-20170427105527-0000/1 on worker worker-20170427103838-192.168.5.37-7078
17/04/27 11:08:25 INFO Master: Asked to kill driver driver-20170427105017-0000
17/04/27 11:08:25 INFO Master: Kill request for driver-20170427105017-0000 submitted
17/04/27 11:08:26 INFO Master: Received unregister request from application app-20170427105527-0000
Como obterei driver-20170427105017-0000 e respectivo 192.168.5.242 e da mesma forma como grep app-20170427105527-0000/0 e seu respectivo 192.168.5.175 .
Responder1
Usando sed
para obtertodos driver
e executor
mensagens relacionadas ao "Lançamento":
$ sed -n -E 's/^.*Launching (driver|executor) ([^ ]*).*worker-[0-9]*-([^-]*).*$/\2 \3/p' file.in
driver-20170427105017-0000 192.168.5.242
app-20170427105527-0000/0 192.168.5.175
app-20170427105527-0000/1 192.168.5.37
[^ ]*
corresponderá a qualquer número de caracteres, exceto espaço.\2
e\3
são referências anteriores ao que corresponde ao segundo e terceiro parênteses, respectivamente. Os segundos parênteses contêm[^ ]*
e corresponderão ao texto apósLaunching driver
ouLaunching executor
e os terceiros parênteses contêm[^-]*
e corresponderão ao endereço IP (até o-
qual termina o endereço).^
e$
nass/^...$/.../p
âncoras a expressão regular no início e no final da linha, enquantop
dizsed
para "imprimir" o resultado da substituição, se houver.
Alternativamente, e possivelmente mais robusto devido à menos magia de expressão regular, usando awk
:
$ awk '/Launching/ { split($NF, a, "-"); print $7, a[3] }' file.in