blob: 43bc86ccefcfe22e70881539c0b7f81882a7de70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
---
- name: Reset checkout to clean state # noqa command-instead-of-module
ansible.builtin.shell:
cmd: "git clean -dfx; git reset --hard"
chdir: "{{ xla_build_dir }}/"
when: openxla_version == 'git'
- name: Configure default OpenXLA settings
ansible.builtin.template:
src: "tf_configure.bazelrc"
dest: "{{ xla_build_dir }}/.tf_configure.bazelrc"
mode: 0400
force: true
- name: (Python {{ py_ver }}) copy upper constraints
local_action:
module: ansible.builtin.template
src: "upper-constraints.txt"
dest: "{{ build_dir }}/configs/ldcg-python-openxla/upper-constraints.txt"
mode: 0644 # needs to be readable in container as well
force: true
- name: (Python {{ py_ver }}) build Python versioned container
community.docker.docker_image:
name: "xla-multipython-py{{ py_ver }}-{{ image_prefix }}"
build:
path: "{{ build_dir }}/configs/ldcg-python-openxla/"
args:
tag_prefix: "{{ image_prefix }}"
py_major_minor_version: "{{ py_ver }}"
source: build
force_source: true
- name: (Python {{ py_ver }}) start build container
community.docker.docker_container:
name: "xla-py{{ py_ver }}"
image: "xla-multipython-py{{ py_ver }}-{{ image_prefix }}"
state: started
restart: true
volumes:
- "{{ xla_build_dir }}:/tf/xla"
- "{{ build_dir }}/bazel-cache:/tf/bazel-cache"
detach: true
user: buildslave
working_dir: "/tf/xla"
network_mode: host
etc_hosts:
ldcg-aarch64-02: 172.17.0.1
command: "sleep infinity"
timeout: 6000
- name: (Python {{ py_ver }}) create buildslave bazel cache dir
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: |
install -d -m0777 .cache/bazel/_bazel_buildslave
chdir: "/home/buildslave/"
- name: (Python {{ py_ver }}) create link for bazel cache
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: |
ln -sf /tf/bazel-cache bazel/_bazel_buildslave/cache
chdir: "/home/buildslave/.cache/"
- name: (Python {{ py_ver }}) create link for bazelisk cache
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: |
ln -sf /tf/bazel-cache bazelisk
chdir: "/home/buildslave/.cache/"
- name: (Python {{ py_ver }}) create link for pip cache
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: |
ln -sf /tf/cache pip
chdir: "/home/buildslave/.cache/"
- name: (Python {{ py_ver }}) collect list of installed Python packages for build
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: "/usr/local/bin/python3 -m pip list -v"
chdir: "/tf/xla"
register: pip_list_output
- name: Show list of installed Python packages for build
ansible.builtin.debug:
var: pip_list_output.stdout
- name: (Python {{ py_ver }}) build OpenXLA {{ openxla_version }}
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: "bazel build -- //xla/..."
chdir: "/tf/xla"
- name: (Python {{ py_ver }}) create script to run tests
ansible.builtin.template:
src: "run-tests.sh.j2"
dest: "{{ xla_build_dir }}/run-tests.sh"
mode: 0755
force: true
- name: (Python {{ py_ver }}) run OpenXLA {{ openxla_version }} tests
community.docker.docker_container_exec:
container: "xla-py{{ py_ver }}"
command: "bash run-tests.sh"
chdir: "/tf/xla"
register: test_output
ignore_errors: true
- name: (Python {{ py_ver }}) Extract number of tests run
ansible.builtin.set_fact:
ut_tests_line: "{{ test_output.stdout | regex_search('^Executed [0-9]+ out of [0-9]+ tests: [0-9]+ tests pass.*', multiline=True) }}"
- name: (Python {{ py_ver }}) Show number of tests run
ansible.builtin.debug:
var: ut_tests_line
- name: (Python {{ py_ver }}) Extract failed tests
ansible.builtin.set_fact:
tests_failed: "{{ test_output.stderr | regex_findall('FAIL: .*', multiline=True) }}"
tests_flaky: "{{ test_output.stdout | regex_findall('.*FLAKY.*', multiline=True) }}"
- name: (Python {{ py_ver }}) Show which tests are flaky
ansible.builtin.debug:
var: tests_flaky
- name: (Python {{ py_ver }}) Show which tests failed
ansible.builtin.debug:
var: tests_failed
- name: (Python {{ py_ver }}) stop build container
community.docker.docker_container:
name: "xla-py{{ py_ver }}"
image: "xla-multipython-py{{ py_ver }}-{{ image_prefix }}"
state: absent
timeout: 6000
|