BUILD.bazel 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963
  1. # Bazel build
  2. # C/C++ documentation: https://docs.bazel.build/versions/master/be/c-cpp.html
  3. load("@rules_python//python:defs.bzl", "py_library")
  4. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
  5. load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
  6. load("@com_github_grpc_grpc//bazel:cython_library.bzl", "pyx_library")
  7. load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
  8. load("//bazel:ray.bzl", "COPTS", "PYX_COPTS", "PYX_SRCS", "copy_to_workspace")
  9. config_setting(
  10. name = "msvc-cl",
  11. flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"},
  12. )
  13. config_setting(
  14. name = "clang-cl",
  15. flag_values = {"@bazel_tools//tools/cpp:compiler": "clang-cl"},
  16. )
  17. config_setting(
  18. name = "opt",
  19. values = {"compilation_mode": "opt"},
  20. )
  21. # === Begin of rpc definitions ===
  22. # GRPC common lib.
  23. cc_library(
  24. name = "grpc_common_lib",
  25. srcs = glob([
  26. "src/ray/rpc/*.cc",
  27. ]),
  28. hdrs = glob([
  29. "src/ray/rpc/*.h",
  30. ]),
  31. copts = COPTS,
  32. strip_include_prefix = "src",
  33. deps = [
  34. ":ray_common",
  35. "@boost//:asio",
  36. "@com_github_grpc_grpc//:grpc++",
  37. "@com_google_protobuf//:protobuf",
  38. ],
  39. )
  40. # Node manager gRPC lib.
  41. cc_grpc_library(
  42. name = "node_manager_cc_grpc",
  43. srcs = ["//src/ray/protobuf:node_manager_proto"],
  44. grpc_only = True,
  45. deps = ["//src/ray/protobuf:node_manager_cc_proto"],
  46. )
  47. # Node manager server and client.
  48. cc_library(
  49. name = "node_manager_rpc",
  50. hdrs = glob([
  51. "src/ray/rpc/node_manager/*.h",
  52. ]),
  53. copts = COPTS,
  54. strip_include_prefix = "src",
  55. deps = [
  56. ":grpc_common_lib",
  57. ":node_manager_cc_grpc",
  58. ":ray_common",
  59. "@boost//:asio",
  60. "@com_github_grpc_grpc//:grpc++",
  61. ],
  62. )
  63. # gcs_service gRPC lib.
  64. cc_grpc_library(
  65. name = "gcs_service_cc_grpc",
  66. srcs = ["//src/ray/protobuf:gcs_service_proto"],
  67. grpc_only = True,
  68. deps = ["//src/ray/protobuf:gcs_service_cc_proto"],
  69. )
  70. # gcs rpc server and client.
  71. cc_library(
  72. name = "gcs_service_rpc",
  73. hdrs = glob([
  74. "src/ray/rpc/gcs_server/gcs_rpc_server.h",
  75. "src/ray/rpc/gcs_server/gcs_rpc_client.h",
  76. ]),
  77. copts = COPTS,
  78. strip_include_prefix = "src",
  79. deps = [
  80. ":gcs_service_cc_grpc",
  81. ":grpc_common_lib",
  82. ":ray_common",
  83. "@boost//:asio",
  84. "@com_github_grpc_grpc//:grpc++",
  85. ],
  86. )
  87. # Object manager gRPC lib.
  88. cc_grpc_library(
  89. name = "object_manager_cc_grpc",
  90. srcs = ["//src/ray/protobuf:object_manager_proto"],
  91. grpc_only = True,
  92. deps = ["//src/ray/protobuf:object_manager_cc_proto"],
  93. )
  94. # Object manager rpc server and client.
  95. cc_library(
  96. name = "object_manager_rpc",
  97. hdrs = glob([
  98. "src/ray/rpc/object_manager/*.h",
  99. ]),
  100. copts = COPTS,
  101. strip_include_prefix = "src",
  102. deps = [
  103. ":grpc_common_lib",
  104. ":object_manager_cc_grpc",
  105. ":ray_common",
  106. "@boost//:asio",
  107. "@com_github_grpc_grpc//:grpc++",
  108. ],
  109. )
  110. # Worker gRPC lib.
  111. cc_grpc_library(
  112. name = "worker_cc_grpc",
  113. srcs = ["//src/ray/protobuf:core_worker_proto"],
  114. grpc_only = True,
  115. deps = ["//src/ray/protobuf:worker_cc_proto"],
  116. )
  117. # worker server and client.
  118. cc_library(
  119. name = "worker_rpc",
  120. srcs = glob([
  121. "src/ray/rpc/worker/*.cc",
  122. ]),
  123. hdrs = glob([
  124. "src/ray/rpc/worker/*.h",
  125. ]),
  126. copts = COPTS,
  127. strip_include_prefix = "src",
  128. deps = [
  129. ":grpc_common_lib",
  130. ":ray_common",
  131. ":worker_cc_grpc",
  132. "@boost//:asio",
  133. "@boost//:thread",
  134. "@com_github_grpc_grpc//:grpc++",
  135. ],
  136. )
  137. # Metrics Agent gRPC lib.
  138. cc_grpc_library(
  139. name = "reporter_cc_grpc",
  140. srcs = ["//src/ray/protobuf:reporter_proto"],
  141. grpc_only = True,
  142. deps = ["//src/ray/protobuf:reporter_cc_proto"],
  143. )
  144. # Metrics Agent client.
  145. cc_library(
  146. name = "reporter_rpc",
  147. hdrs = glob([
  148. "src/ray/rpc/metrics_agent_client.h",
  149. ]),
  150. copts = COPTS,
  151. strip_include_prefix = "src",
  152. deps = [
  153. ":grpc_common_lib",
  154. ":ray_common",
  155. ":reporter_cc_grpc",
  156. "@boost//:asio",
  157. "@boost//:thread",
  158. "@com_github_grpc_grpc//:grpc++",
  159. ],
  160. )
  161. # Agent manager.
  162. cc_grpc_library(
  163. name = "agent_manager_cc_grpc",
  164. srcs = ["//src/ray/protobuf:agent_manager_proto"],
  165. grpc_only = True,
  166. deps = ["//src/ray/protobuf:agent_manager_cc_proto"],
  167. )
  168. cc_library(
  169. name = "agent_manager_rpc",
  170. hdrs = glob([
  171. "src/ray/rpc/agent_manager/*.h",
  172. ]),
  173. copts = COPTS,
  174. strip_include_prefix = "src",
  175. deps = [
  176. ":agent_manager_cc_grpc",
  177. ":grpc_common_lib",
  178. ":ray_common",
  179. "@boost//:asio",
  180. "@com_github_grpc_grpc//:grpc++",
  181. ],
  182. )
  183. # === End of rpc definitions ===
  184. # === Begin of plasma definitions ===
  185. # TODO(mehrdadn): (How to) support dynamic linking?
  186. PROPAGATED_WINDOWS_DEFINES = ["ARROW_STATIC"]
  187. PLASMA_COPTS = COPTS + select({
  188. "@bazel_tools//src/conditions:windows": [
  189. ] + ["-D" + define for define in PROPAGATED_WINDOWS_DEFINES],
  190. "//conditions:default": [
  191. "-DARROW_USE_GLOG",
  192. ],
  193. })
  194. PLASMA_LINKOPTS = [] + select({
  195. "@bazel_tools//src/conditions:windows": [
  196. "-DefaultLib:" + "ws2_32.lib",
  197. ],
  198. "//conditions:default": [
  199. ],
  200. })
  201. cc_library(
  202. name = "plasma_client",
  203. srcs = [
  204. "src/ray/object_manager/plasma/client.cc",
  205. "src/ray/object_manager/plasma/connection.cc",
  206. "src/ray/object_manager/plasma/malloc.cc",
  207. "src/ray/object_manager/plasma/plasma.cc",
  208. "src/ray/object_manager/plasma/protocol.cc",
  209. "src/ray/object_manager/plasma/shared_memory.cc",
  210. ] + select({
  211. "@bazel_tools//src/conditions:windows": [
  212. ],
  213. "//conditions:default": [
  214. "src/ray/object_manager/plasma/fling.cc",
  215. ],
  216. }),
  217. hdrs = [
  218. "src/ray/object_manager/format/object_manager_generated.h",
  219. "src/ray/object_manager/notification/object_store_notification_manager.h",
  220. "src/ray/object_manager/plasma/client.h",
  221. "src/ray/object_manager/plasma/common.h",
  222. "src/ray/object_manager/plasma/compat.h",
  223. "src/ray/object_manager/plasma/external_store.h",
  224. "src/ray/object_manager/plasma/connection.h",
  225. "src/ray/object_manager/plasma/malloc.h",
  226. "src/ray/object_manager/plasma/plasma.h",
  227. "src/ray/object_manager/plasma/plasma_generated.h",
  228. "src/ray/object_manager/plasma/protocol.h",
  229. "src/ray/object_manager/plasma/shared_memory.h",
  230. ] + select({
  231. "@bazel_tools//src/conditions:windows": [
  232. ],
  233. "//conditions:default": [
  234. "src/ray/object_manager/plasma/fling.h",
  235. ],
  236. }),
  237. copts = PLASMA_COPTS,
  238. defines = select({
  239. "@bazel_tools//src/conditions:windows": PROPAGATED_WINDOWS_DEFINES,
  240. "//conditions:default": [],
  241. }),
  242. linkopts = PLASMA_LINKOPTS,
  243. strip_include_prefix = "src",
  244. deps = [
  245. ":object_manager_fbs",
  246. ":plasma_fbs",
  247. ":ray_common",
  248. ":ray_util",
  249. "//src/ray/protobuf:common_cc_proto",
  250. "@arrow",
  251. "@com_github_google_glog//:glog",
  252. "@msgpack",
  253. ],
  254. )
  255. cc_library(
  256. name = "plasma_store_server_lib",
  257. srcs = [
  258. "src/ray/object_manager/plasma/dlmalloc.cc",
  259. "src/ray/object_manager/plasma/eviction_policy.cc",
  260. "src/ray/object_manager/plasma/external_store.cc",
  261. "src/ray/object_manager/plasma/plasma_allocator.cc",
  262. "src/ray/object_manager/plasma/quota_aware_policy.cc",
  263. "src/ray/object_manager/plasma/store.cc",
  264. "src/ray/object_manager/plasma/store_runner.cc",
  265. ],
  266. hdrs = [
  267. "src/ray/object_manager/plasma/eviction_policy.h",
  268. "src/ray/object_manager/plasma/external_store.h",
  269. "src/ray/object_manager/plasma/plasma_allocator.h",
  270. "src/ray/object_manager/plasma/quota_aware_policy.h",
  271. "src/ray/object_manager/plasma/store.h",
  272. "src/ray/object_manager/plasma/store_runner.h",
  273. "src/ray/thirdparty/dlmalloc.c",
  274. ],
  275. copts = PLASMA_COPTS,
  276. linkopts = PLASMA_LINKOPTS,
  277. strip_include_prefix = "src",
  278. deps = [
  279. ":plasma_client",
  280. "@com_github_google_glog//:glog",
  281. ],
  282. )
  283. cc_binary(
  284. name = "plasma_store_server",
  285. srcs = [
  286. "src/ray/plasma/store_exec.cc",
  287. ],
  288. copts = PLASMA_COPTS,
  289. visibility = ["//visibility:public"],
  290. deps = [
  291. ":plasma_store_server_lib",
  292. ],
  293. )
  294. FLATC_ARGS = [
  295. "--gen-object-api",
  296. "--gen-mutable",
  297. "--scoped-enums",
  298. ]
  299. flatbuffer_cc_library(
  300. name = "plasma_fbs",
  301. srcs = ["src/ray/object_manager/plasma/plasma.fbs"],
  302. flatc_args = FLATC_ARGS,
  303. out_prefix = "src/ray/object_manager/plasma/",
  304. )
  305. # === End of plasma definitions ===
  306. cc_library(
  307. name = "ray_common",
  308. srcs = glob(
  309. [
  310. "src/ray/common/**/*.cc",
  311. ],
  312. exclude = [
  313. "src/ray/common/**/*_test.cc",
  314. ],
  315. ),
  316. hdrs = glob(
  317. [
  318. "src/ray/common/**/*.h",
  319. ],
  320. ),
  321. copts = COPTS,
  322. strip_include_prefix = "src",
  323. visibility = ["//visibility:public"],
  324. deps = [
  325. ":node_manager_fbs",
  326. ":ray_util",
  327. "//src/ray/protobuf:common_cc_proto",
  328. "//src/ray/protobuf:gcs_cc_proto",
  329. "@arrow",
  330. "@boost//:asio",
  331. "@com_github_grpc_grpc//:grpc++",
  332. "@com_google_absl//absl/container:flat_hash_map",
  333. "@com_google_absl//absl/container:flat_hash_set",
  334. "@com_google_absl//absl/memory",
  335. "@com_google_googletest//:gtest",
  336. "@msgpack",
  337. ],
  338. )
  339. # This header is used to warp some streaming code so we can reduce suspicious
  340. # symbols export.
  341. cc_library(
  342. name = "exported_streaming_internal",
  343. srcs = glob(
  344. [
  345. "src/ray/streaming/streaming.cc",
  346. ],
  347. ),
  348. hdrs = glob(
  349. [
  350. "src/ray/streaming/streaming.h",
  351. ],
  352. ),
  353. copts = COPTS,
  354. strip_include_prefix = "src",
  355. visibility = ["//visibility:public"],
  356. deps = [
  357. ":core_worker_lib",
  358. ],
  359. alwayslink = 1,
  360. )
  361. cc_binary(
  362. name = "raylet",
  363. srcs = ["src/ray/raylet/main.cc"],
  364. copts = COPTS,
  365. visibility = ["//java:__subpackages__"],
  366. deps = [
  367. ":ray_util",
  368. ":raylet_lib",
  369. "@com_github_gflags_gflags//:gflags",
  370. ],
  371. )
  372. cc_library(
  373. name = "gcs_pub_sub_lib",
  374. srcs = glob(
  375. [
  376. "src/ray/gcs/pubsub/gcs_pub_sub.cc",
  377. ],
  378. ),
  379. hdrs = glob(
  380. [
  381. "src/ray/gcs/pubsub/gcs_pub_sub.h",
  382. ],
  383. ),
  384. copts = COPTS,
  385. strip_include_prefix = "src",
  386. deps = [
  387. ":gcs",
  388. ":ray_common",
  389. ":redis_client",
  390. ],
  391. )
  392. cc_test(
  393. name = "gcs_pub_sub_test",
  394. srcs = ["src/ray/gcs/pubsub/test/gcs_pub_sub_test.cc"],
  395. args = [
  396. "$(location redis-server)",
  397. "$(location redis-cli)",
  398. "$(location libray_redis_module.so)",
  399. ],
  400. copts = COPTS,
  401. data = [
  402. "//:libray_redis_module.so",
  403. "//:redis-cli",
  404. "//:redis-server",
  405. ],
  406. deps = [
  407. ":gcs_pub_sub_lib",
  408. "@com_google_googletest//:gtest_main",
  409. ],
  410. )
  411. cc_library(
  412. name = "gcs_server_lib",
  413. srcs = glob(
  414. [
  415. "src/ray/gcs/gcs_server/*.cc",
  416. ],
  417. exclude = [
  418. "src/ray/gcs/gcs_server/gcs_server_main.cc",
  419. "src/ray/gcs/gcs_server/test/*.cc",
  420. ],
  421. ),
  422. hdrs = glob(
  423. [
  424. "src/ray/gcs/gcs_server/*.h",
  425. ],
  426. ),
  427. copts = COPTS,
  428. strip_include_prefix = "src",
  429. deps = [
  430. ":agent_manager_rpc",
  431. ":gcs",
  432. ":gcs_pub_sub_lib",
  433. ":gcs_service_rpc",
  434. ":gcs_table_storage_lib",
  435. ":node_manager_rpc",
  436. ":raylet_client_lib",
  437. ":worker_rpc",
  438. ],
  439. )
  440. cc_binary(
  441. name = "gcs_server",
  442. srcs = [
  443. "src/ray/gcs/gcs_server/gcs_server_main.cc",
  444. ],
  445. copts = COPTS,
  446. visibility = ["//java:__subpackages__"],
  447. deps = [
  448. ":gcs_server_lib",
  449. ":stats_lib",
  450. "@com_github_gflags_gflags//:gflags",
  451. ],
  452. )
  453. cc_library(
  454. name = "stats_lib",
  455. srcs = glob(
  456. [
  457. "src/ray/stats/*.cc",
  458. ],
  459. exclude = [
  460. "src/ray/stats/*_test.cc",
  461. ],
  462. ),
  463. hdrs = glob(
  464. [
  465. "src/ray/stats/*.h",
  466. ],
  467. ),
  468. copts = COPTS,
  469. linkopts = select({
  470. "@bazel_tools//src/conditions:windows": [
  471. ],
  472. "//conditions:default": [
  473. "-lpthread",
  474. ],
  475. }),
  476. strip_include_prefix = "src",
  477. deps = [
  478. ":ray_util",
  479. ":reporter_rpc",
  480. "@com_github_jupp0r_prometheus_cpp//pull",
  481. "@com_google_absl//absl/base:core_headers",
  482. "@com_google_absl//absl/memory",
  483. "@com_google_absl//absl/strings",
  484. "@com_google_googletest//:gtest",
  485. "@io_opencensus_cpp//opencensus/exporters/stats/prometheus:prometheus_exporter",
  486. "@io_opencensus_cpp//opencensus/exporters/stats/stdout:stdout_exporter",
  487. "@io_opencensus_cpp//opencensus/stats",
  488. "@io_opencensus_cpp//opencensus/tags",
  489. ],
  490. )
  491. cc_library(
  492. name = "raylet_lib",
  493. srcs = glob(
  494. [
  495. "src/ray/raylet/**/*.cc",
  496. ],
  497. exclude = [
  498. "src/ray/raylet/**/*_test.cc",
  499. "src/ray/raylet/main.cc",
  500. ],
  501. ),
  502. hdrs = glob(
  503. [
  504. "src/ray/raylet/**/*.h",
  505. "src/ray/core_worker/common.h",
  506. ],
  507. ),
  508. copts = COPTS,
  509. linkopts = select({
  510. "@bazel_tools//src/conditions:windows": [
  511. ],
  512. "//conditions:default": [
  513. "-lpthread",
  514. ],
  515. }),
  516. strip_include_prefix = "src",
  517. visibility = ["//streaming:__subpackages__"],
  518. deps = [
  519. ":agent_manager_rpc",
  520. ":gcs",
  521. ":node_manager_fbs",
  522. ":node_manager_rpc",
  523. ":object_manager",
  524. ":plasma_client",
  525. ":ray_common",
  526. ":ray_util",
  527. ":service_based_gcs_client_lib",
  528. ":stats_lib",
  529. ":worker_rpc",
  530. "//src/ray/protobuf:common_cc_proto",
  531. "@boost//:asio",
  532. "@com_github_jupp0r_prometheus_cpp//pull",
  533. "@com_google_absl//absl/base:core_headers",
  534. "@com_google_absl//absl/container:flat_hash_set",
  535. "@com_google_absl//absl/memory",
  536. "@com_google_absl//absl/strings",
  537. "@com_google_googletest//:gtest",
  538. "@io_opencensus_cpp//opencensus/exporters/stats/prometheus:prometheus_exporter",
  539. "@io_opencensus_cpp//opencensus/stats",
  540. "@io_opencensus_cpp//opencensus/tags",
  541. ],
  542. )
  543. cc_library(
  544. name = "raylet_client_lib",
  545. srcs = glob([
  546. "src/ray/raylet_client/*.cc",
  547. ]),
  548. hdrs = glob([
  549. "src/ray/raylet_client/*.h",
  550. ]),
  551. copts = COPTS,
  552. linkopts = select({
  553. "@bazel_tools//src/conditions:windows": [
  554. ],
  555. "//conditions:default": [
  556. "-lpthread",
  557. ],
  558. }),
  559. strip_include_prefix = "src",
  560. visibility = ["//streaming:__subpackages__"],
  561. deps = [
  562. ":agent_manager_rpc",
  563. ":node_manager_fbs",
  564. ":node_manager_rpc",
  565. ":ray_common",
  566. ":ray_util",
  567. "//src/ray/protobuf:gcs_cc_proto",
  568. "@boost//:asio",
  569. ],
  570. )
  571. cc_library(
  572. name = "core_worker_lib",
  573. srcs = glob(
  574. [
  575. "src/ray/core_worker/*.cc",
  576. "src/ray/core_worker/store_provider/*.cc",
  577. "src/ray/core_worker/store_provider/memory_store/*.cc",
  578. "src/ray/core_worker/transport/*.cc",
  579. "src/ray/rpc/worker/*.cc",
  580. ],
  581. exclude = [
  582. "src/ray/core_worker/**/*_test.cc",
  583. "src/ray/core_worker/mock_worker.cc",
  584. ],
  585. ),
  586. hdrs = glob([
  587. "src/ray/core_worker/*.h",
  588. "src/ray/core_worker/store_provider/*.h",
  589. "src/ray/core_worker/store_provider/memory_store/*.h",
  590. "src/ray/core_worker/transport/*.h",
  591. ]),
  592. copts = COPTS,
  593. strip_include_prefix = "src",
  594. visibility = ["//visibility:public"],
  595. deps = [
  596. ":gcs",
  597. ":plasma_client",
  598. ":ray_common",
  599. ":ray_util",
  600. ":raylet_client_lib",
  601. ":service_based_gcs_client_lib",
  602. ":stats_lib",
  603. ":worker_rpc",
  604. "//src/ray/protobuf:worker_cc_proto",
  605. "@boost//:fiber",
  606. "@com_google_absl//absl/container:flat_hash_map",
  607. "@com_google_absl//absl/container:flat_hash_set",
  608. ],
  609. )
  610. cc_library(
  611. name = "mock_worker_lib",
  612. srcs = ["src/ray/core_worker/test/mock_worker.cc"],
  613. hdrs = glob([
  614. "src/ray/core_worker/test/*.h",
  615. ]),
  616. copts = COPTS,
  617. strip_include_prefix = "src",
  618. deps = [
  619. ":core_worker_lib",
  620. ],
  621. )
  622. cc_binary(
  623. name = "mock_worker",
  624. copts = COPTS,
  625. deps = [
  626. ":mock_worker_lib",
  627. ],
  628. )
  629. cc_test(
  630. name = "core_worker_test",
  631. srcs = ["src/ray/core_worker/test/core_worker_test.cc"],
  632. args = [
  633. "$(location //:plasma_store_server)",
  634. "$(location raylet)",
  635. "$(location mock_worker)",
  636. "$(location gcs_server)",
  637. "$(location redis-cli)",
  638. "$(location redis-server)",
  639. "$(location libray_redis_module.so)",
  640. ],
  641. copts = COPTS,
  642. data = [
  643. "//:gcs_server",
  644. "//:libray_redis_module.so",
  645. "//:mock_worker",
  646. "//:plasma_store_server",
  647. "//:raylet",
  648. "//:redis-cli",
  649. "//:redis-server",
  650. ],
  651. deps = [
  652. ":core_worker_lib",
  653. ":gcs",
  654. "@com_google_absl//absl/container:flat_hash_map",
  655. "@com_google_absl//absl/container:flat_hash_set",
  656. "@com_google_googletest//:gtest_main",
  657. ],
  658. )
  659. cc_test(
  660. name = "direct_actor_transport_test",
  661. srcs = ["src/ray/core_worker/test/direct_actor_transport_test.cc"],
  662. copts = COPTS,
  663. deps = [
  664. ":core_worker_lib",
  665. "@com_google_googletest//:gtest_main",
  666. ],
  667. )
  668. cc_test(
  669. name = "direct_task_transport_test",
  670. srcs = ["src/ray/core_worker/test/direct_task_transport_test.cc"],
  671. copts = COPTS,
  672. deps = [
  673. ":core_worker_lib",
  674. "@com_google_googletest//:gtest_main",
  675. ],
  676. )
  677. cc_test(
  678. name = "reference_count_test",
  679. srcs = ["src/ray/core_worker/reference_count_test.cc"],
  680. copts = COPTS,
  681. deps = [
  682. ":core_worker_lib",
  683. "@com_google_googletest//:gtest_main",
  684. ],
  685. )
  686. cc_test(
  687. name = "object_recovery_manager_test",
  688. srcs = ["src/ray/core_worker/test/object_recovery_manager_test.cc"],
  689. copts = COPTS,
  690. deps = [
  691. ":core_worker_lib",
  692. "@com_google_googletest//:gtest_main",
  693. ],
  694. )
  695. cc_test(
  696. name = "scheduling_queue_test",
  697. srcs = ["src/ray/core_worker/test/scheduling_queue_test.cc"],
  698. copts = COPTS,
  699. deps = [
  700. ":core_worker_lib",
  701. "@com_google_googletest//:gtest_main",
  702. ],
  703. )
  704. cc_test(
  705. name = "task_manager_test",
  706. srcs = ["src/ray/core_worker/test/task_manager_test.cc"],
  707. copts = COPTS,
  708. deps = [
  709. ":core_worker_lib",
  710. "@com_google_googletest//:gtest_main",
  711. ],
  712. )
  713. cc_test(
  714. name = "actor_manager_test",
  715. srcs = ["src/ray/core_worker/test/actor_manager_test.cc"],
  716. copts = COPTS,
  717. deps = [
  718. ":core_worker_lib",
  719. "@com_google_googletest//:gtest_main",
  720. ],
  721. )
  722. cc_test(
  723. name = "cluster_resource_scheduler_test",
  724. srcs = [
  725. "src/ray/raylet/scheduling/cluster_resource_scheduler_test.cc",
  726. ],
  727. copts = COPTS,
  728. deps = [
  729. ":raylet_lib",
  730. "@com_google_googletest//:gtest_main",
  731. ],
  732. )
  733. cc_test(
  734. name = "cluster_task_manager_test",
  735. srcs = [
  736. "src/ray/raylet/scheduling/cluster_task_manager_test.cc",
  737. ],
  738. copts = COPTS,
  739. deps = [
  740. ":raylet_lib",
  741. "@com_google_googletest//:gtest_main",
  742. ],
  743. )
  744. cc_test(
  745. name = "reconstruction_policy_test",
  746. srcs = ["src/ray/raylet/reconstruction_policy_test.cc"],
  747. copts = COPTS + select({
  748. "//:msvc-cl": [
  749. ],
  750. "//conditions:default": [
  751. # Ignore this warning since it's impractical to fix in the relevant headers
  752. "-Wno-inconsistent-missing-override",
  753. ],
  754. }),
  755. deps = [
  756. ":node_manager_fbs",
  757. ":object_manager",
  758. ":raylet_lib",
  759. "@com_google_googletest//:gtest_main",
  760. ],
  761. )
  762. cc_test(
  763. name = "worker_pool_test",
  764. srcs = ["src/ray/raylet/worker_pool_test.cc"],
  765. copts = COPTS,
  766. deps = [
  767. ":raylet_lib",
  768. "@com_google_googletest//:gtest_main",
  769. ],
  770. )
  771. cc_test(
  772. name = "scheduling_resources_test",
  773. srcs = ["src/ray/common/task/scheduling_resources_test.cc"],
  774. copts = COPTS,
  775. deps = [
  776. "ray_common",
  777. "@com_google_googletest//:gtest_main",
  778. ],
  779. )
  780. cc_test(
  781. name = "id_test",
  782. srcs = ["src/ray/common/id_test.cc"],
  783. copts = COPTS,
  784. deps = [
  785. "ray_common",
  786. "@com_google_googletest//:gtest_main",
  787. ],
  788. )
  789. cc_test(
  790. name = "logging_test",
  791. srcs = ["src/ray/util/logging_test.cc"],
  792. args = ["--gtest_filter=PrintLogTest*"],
  793. copts = COPTS,
  794. deps = [
  795. ":ray_util",
  796. "@boost//:asio",
  797. "@com_google_googletest//:gtest_main",
  798. ],
  799. )
  800. cc_test(
  801. name = "event_test",
  802. srcs = ["src/ray/util/event_test.cc"],
  803. copts = COPTS,
  804. deps = [
  805. ":ray_util",
  806. "@com_google_googletest//:gtest_main",
  807. ],
  808. )
  809. cc_test(
  810. name = "filesystem_test",
  811. srcs = ["src/ray/util/filesystem_test.cc"],
  812. copts = COPTS,
  813. deps = [
  814. ":ray_util",
  815. "@com_google_googletest//:gtest_main",
  816. ],
  817. )
  818. cc_test(
  819. name = "util_test",
  820. srcs = ["src/ray/util/util_test.cc"],
  821. copts = COPTS,
  822. deps = [
  823. ":ray_util",
  824. "@boost//:asio",
  825. "@com_google_googletest//:gtest_main",
  826. ],
  827. )
  828. cc_test(
  829. name = "sample_test",
  830. srcs = ["src/ray/util/sample_test.cc"],
  831. copts = COPTS,
  832. deps = [
  833. ":ray_common",
  834. "@com_google_googletest//:gtest_main",
  835. ],
  836. )
  837. cc_test(
  838. name = "task_dependency_manager_test",
  839. srcs = ["src/ray/raylet/task_dependency_manager_test.cc"],
  840. copts = COPTS,
  841. deps = [
  842. ":raylet_lib",
  843. "@com_google_googletest//:gtest_main",
  844. ],
  845. )
  846. cc_test(
  847. name = "client_connection_test",
  848. srcs = ["src/ray/common/test/client_connection_test.cc"],
  849. copts = COPTS,
  850. deps = [
  851. ":ray_common",
  852. "@com_google_googletest//:gtest_main",
  853. ],
  854. )
  855. cc_test(
  856. name = "signal_test",
  857. srcs = ["src/ray/util/signal_test.cc"],
  858. copts = COPTS,
  859. deps = [
  860. ":raylet_lib",
  861. "@com_google_googletest//:gtest_main",
  862. ],
  863. )
  864. cc_test(
  865. name = "sequencer_test",
  866. srcs = ["src/ray/util/sequencer_test.cc"],
  867. copts = COPTS,
  868. deps = [
  869. ":ray_util",
  870. "@com_google_googletest//:gtest_main",
  871. ],
  872. )
  873. cc_test(
  874. name = "stats_test",
  875. srcs = ["src/ray/stats/stats_test.cc"],
  876. copts = COPTS,
  877. tags = ["stats"],
  878. deps = [
  879. ":stats_lib",
  880. "@com_google_googletest//:gtest_main",
  881. ],
  882. )
  883. cc_test(
  884. name = "metric_exporter_client_test",
  885. srcs = ["src/ray/stats/metric_exporter_client_test.cc"],
  886. copts = COPTS,
  887. tags = ["stats"],
  888. deps = [
  889. ":stats_lib",
  890. "@com_google_googletest//:gtest_main",
  891. ],
  892. )
  893. cc_library(
  894. name = "gcs_test_util_lib",
  895. hdrs = [
  896. "src/ray/gcs/test/accessor_test_base.h",
  897. "src/ray/gcs/test/gcs_test_util.h",
  898. ],
  899. copts = COPTS,
  900. strip_include_prefix = "src",
  901. deps = [
  902. ":gcs",
  903. ":gcs_service_rpc",
  904. ],
  905. )
  906. cc_test(
  907. name = "gcs_server_rpc_test",
  908. srcs = [
  909. "src/ray/gcs/gcs_server/test/gcs_server_rpc_test.cc",
  910. ],
  911. args = [
  912. "$(location redis-server)",
  913. "$(location redis-cli)",
  914. "$(location libray_redis_module.so)",
  915. ],
  916. copts = COPTS,
  917. data = [
  918. "//:libray_redis_module.so",
  919. "//:redis-cli",
  920. "//:redis-server",
  921. ],
  922. deps = [
  923. ":gcs_server_lib",
  924. ":gcs_test_util_lib",
  925. "@com_google_googletest//:gtest_main",
  926. ],
  927. )
  928. cc_library(
  929. name = "gcs_server_test_util",
  930. hdrs = [
  931. "src/ray/gcs/gcs_server/test/gcs_server_test_util.h",
  932. ],
  933. copts = COPTS,
  934. strip_include_prefix = "src",
  935. )
  936. cc_test(
  937. name = "gcs_node_manager_test",
  938. srcs = [
  939. "src/ray/gcs/gcs_server/test/gcs_node_manager_test.cc",
  940. ],
  941. copts = COPTS,
  942. deps = [
  943. ":gcs_server_lib",
  944. ":gcs_server_test_util",
  945. ":gcs_test_util_lib",
  946. "@com_google_googletest//:gtest_main",
  947. ],
  948. )
  949. cc_test(
  950. name = "gcs_placement_group_manager_test",
  951. srcs = [
  952. "src/ray/gcs/gcs_server/test/gcs_placement_group_manager_test.cc",
  953. ],
  954. copts = COPTS,
  955. deps = [
  956. ":gcs_server_lib",
  957. ":gcs_server_test_util",
  958. ":gcs_test_util_lib",
  959. "@com_google_googletest//:gtest_main",
  960. ],
  961. )
  962. cc_test(
  963. name = "gcs_placement_group_scheduler_test",
  964. srcs = [
  965. "src/ray/gcs/gcs_server/test/gcs_placement_group_scheduler_test.cc",
  966. ],
  967. copts = COPTS,
  968. deps = [
  969. ":gcs_server_lib",
  970. ":gcs_server_test_util",
  971. ":gcs_test_util_lib",
  972. "@com_google_googletest//:gtest_main",
  973. ],
  974. )
  975. cc_test(
  976. name = "gcs_actor_scheduler_test",
  977. srcs = [
  978. "src/ray/gcs/gcs_server/test/gcs_actor_scheduler_test.cc",
  979. ],
  980. copts = COPTS,
  981. deps = [
  982. ":gcs_server_lib",
  983. ":gcs_server_test_util",
  984. ":gcs_test_util_lib",
  985. "@com_google_googletest//:gtest_main",
  986. ],
  987. )
  988. cc_test(
  989. name = "gcs_actor_manager_test",
  990. srcs = [
  991. "src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc",
  992. ],
  993. copts = COPTS,
  994. deps = [
  995. ":gcs_server_lib",
  996. ":gcs_server_test_util",
  997. ":gcs_test_util_lib",
  998. "@com_google_googletest//:gtest_main",
  999. ],
  1000. )
  1001. cc_library(
  1002. name = "gcs_table_storage_lib",
  1003. srcs = glob(
  1004. [
  1005. "src/ray/gcs/gcs_server/gcs_table_storage.cc",
  1006. ],
  1007. ),
  1008. hdrs = glob(
  1009. [
  1010. "src/ray/gcs/gcs_server/gcs_table_storage.h",
  1011. ],
  1012. ),
  1013. copts = COPTS,
  1014. strip_include_prefix = "src",
  1015. deps = [
  1016. ":gcs",
  1017. ":gcs_in_memory_store_client",
  1018. ":ray_common",
  1019. ":redis_store_client",
  1020. ],
  1021. )
  1022. cc_library(
  1023. name = "gcs_table_storage_test_lib",
  1024. hdrs = [
  1025. "src/ray/gcs/gcs_server/test/gcs_table_storage_test_base.h",
  1026. ],
  1027. copts = COPTS,
  1028. strip_include_prefix = "src",
  1029. deps = [
  1030. "redis_store_client",
  1031. ],
  1032. )
  1033. cc_test(
  1034. name = "redis_gcs_table_storage_test",
  1035. srcs = [
  1036. "src/ray/gcs/gcs_server/test/redis_gcs_table_storage_test.cc",
  1037. ],
  1038. args = [
  1039. "$(location redis-server)",
  1040. "$(location redis-cli)",
  1041. "$(location libray_redis_module.so)",
  1042. ],
  1043. copts = COPTS,
  1044. data = [
  1045. "//:libray_redis_module.so",
  1046. "//:redis-cli",
  1047. "//:redis-server",
  1048. ],
  1049. deps = [
  1050. ":gcs_table_storage_lib",
  1051. ":gcs_table_storage_test_lib",
  1052. ":gcs_test_util_lib",
  1053. ":store_client_test_lib",
  1054. "@com_google_googletest//:gtest_main",
  1055. ],
  1056. )
  1057. cc_test(
  1058. name = "in_memory_gcs_table_storage_test",
  1059. srcs = [
  1060. "src/ray/gcs/gcs_server/test/in_memory_gcs_table_storage_test.cc",
  1061. ],
  1062. copts = COPTS,
  1063. deps = [
  1064. ":gcs_table_storage_lib",
  1065. ":gcs_table_storage_test_lib",
  1066. ":gcs_test_util_lib",
  1067. ":store_client_test_lib",
  1068. "@com_google_googletest//:gtest_main",
  1069. ],
  1070. )
  1071. cc_library(
  1072. name = "service_based_gcs_client_lib",
  1073. srcs = glob(
  1074. [
  1075. "src/ray/gcs/gcs_client/service_based_*.cc",
  1076. ],
  1077. ),
  1078. hdrs = glob(
  1079. [
  1080. "src/ray/gcs/gcs_client/service_based_*.h",
  1081. ],
  1082. ),
  1083. copts = COPTS,
  1084. strip_include_prefix = "src",
  1085. deps = [
  1086. ":gcs",
  1087. ":gcs_pub_sub_lib",
  1088. ":gcs_service_rpc",
  1089. ":redis_store_client",
  1090. ],
  1091. )
  1092. cc_library(
  1093. name = "global_state_accessor_lib",
  1094. srcs = glob(
  1095. [
  1096. "src/ray/gcs/gcs_client/global_state_accessor.cc",
  1097. ],
  1098. ),
  1099. hdrs = glob(
  1100. [
  1101. "src/ray/gcs/gcs_client/global_state_accessor.h",
  1102. ],
  1103. ),
  1104. copts = COPTS,
  1105. strip_include_prefix = "src",
  1106. deps = [
  1107. ":service_based_gcs_client_lib",
  1108. ],
  1109. )
  1110. cc_test(
  1111. name = "global_state_accessor_test",
  1112. srcs = [
  1113. "src/ray/gcs/gcs_client/test/global_state_accessor_test.cc",
  1114. ],
  1115. args = [
  1116. "$(location redis-server)",
  1117. "$(location redis-cli)",
  1118. "$(location libray_redis_module.so)",
  1119. ],
  1120. copts = COPTS,
  1121. data = [
  1122. "//:libray_redis_module.so",
  1123. "//:redis-cli",
  1124. "//:redis-server",
  1125. ],
  1126. deps = [
  1127. ":gcs_server_lib",
  1128. ":gcs_test_util_lib",
  1129. ":global_state_accessor_lib",
  1130. ":service_based_gcs_client_lib",
  1131. "@com_google_googletest//:gtest_main",
  1132. ],
  1133. )
  1134. cc_test(
  1135. name = "gcs_server_test",
  1136. srcs = [
  1137. "src/ray/gcs/gcs_client/test/service_based_gcs_client_test.cc",
  1138. ],
  1139. args = [
  1140. "$(location redis-server)",
  1141. "$(location redis-cli)",
  1142. "$(location libray_redis_module.so)",
  1143. ],
  1144. copts = COPTS,
  1145. data = [
  1146. "//:libray_redis_module.so",
  1147. "//:redis-cli",
  1148. "//:redis-server",
  1149. ],
  1150. deps = [
  1151. ":gcs_server_lib",
  1152. ":gcs_test_util_lib",
  1153. ":service_based_gcs_client_lib",
  1154. "@com_google_googletest//:gtest_main",
  1155. ],
  1156. )
  1157. cc_test(
  1158. name = "gcs_object_manager_test",
  1159. srcs = [
  1160. "src/ray/gcs/gcs_server/test/gcs_object_manager_test.cc",
  1161. ],
  1162. copts = COPTS,
  1163. deps = [
  1164. ":gcs_server_lib",
  1165. ":gcs_server_test_util",
  1166. ":gcs_test_util_lib",
  1167. "@com_google_googletest//:gtest_main",
  1168. ],
  1169. )
  1170. cc_library(
  1171. name = "object_manager",
  1172. srcs = glob([
  1173. "src/ray/object_manager/*.cc",
  1174. "src/ray/object_manager/notification/*.cc",
  1175. ]),
  1176. hdrs = glob([
  1177. "src/ray/object_manager/*.h",
  1178. "src/ray/object_manager/notification/*.h",
  1179. ]),
  1180. copts = COPTS,
  1181. strip_include_prefix = "src",
  1182. deps = [
  1183. ":core_worker_lib",
  1184. ":gcs",
  1185. ":object_manager_fbs",
  1186. ":object_manager_rpc",
  1187. ":plasma_store_server_lib",
  1188. ":ray_common",
  1189. ":ray_util",
  1190. "@boost//:asio",
  1191. ],
  1192. )
  1193. cc_binary(
  1194. name = "object_manager_test",
  1195. testonly = 1,
  1196. srcs = ["src/ray/object_manager/test/object_manager_test.cc"],
  1197. copts = COPTS,
  1198. deps = [
  1199. ":object_manager",
  1200. "//src/ray/protobuf:common_cc_proto",
  1201. "@com_google_googletest//:gtest_main",
  1202. ],
  1203. )
  1204. cc_binary(
  1205. name = "object_manager_stress_test",
  1206. testonly = 1,
  1207. srcs = ["src/ray/object_manager/test/object_manager_stress_test.cc"],
  1208. copts = COPTS,
  1209. deps = [
  1210. ":object_manager",
  1211. "//src/ray/protobuf:common_cc_proto",
  1212. "@com_google_googletest//:gtest_main",
  1213. ],
  1214. )
  1215. cc_library(
  1216. name = "platform_shims",
  1217. srcs = [] + select({
  1218. "@bazel_tools//src/conditions:windows": glob([
  1219. "src/shims/windows/**/*.c",
  1220. "src/shims/windows/**/*.cc",
  1221. "src/shims/windows/**/*.h",
  1222. ]),
  1223. "//conditions:default": [],
  1224. }),
  1225. hdrs = [] + select({
  1226. "@bazel_tools//src/conditions:windows": glob([
  1227. "src/shims/windows/**/*.h",
  1228. ]),
  1229. "//conditions:default": [],
  1230. }),
  1231. copts = COPTS,
  1232. strip_include_prefix = select({
  1233. "@bazel_tools//src/conditions:windows": "src/shims/windows",
  1234. "//conditions:default": "",
  1235. }),
  1236. visibility = ["//visibility:public"],
  1237. )
  1238. cc_library(
  1239. name = "ray_util",
  1240. srcs = glob(
  1241. [
  1242. "src/ray/util/*.cc",
  1243. ],
  1244. exclude = [
  1245. "src/ray/util/*_test.cc",
  1246. ],
  1247. ),
  1248. hdrs = glob([
  1249. "src/ray/util/*.h",
  1250. ]),
  1251. copts = COPTS,
  1252. strip_include_prefix = "src",
  1253. visibility = ["//visibility:public"],
  1254. deps = [
  1255. ":sha256",
  1256. "//src/ray/protobuf:event_cc_proto",
  1257. "@boost//:asio",
  1258. "@com_github_google_glog//:glog",
  1259. "@com_google_absl//absl/synchronization",
  1260. "@com_google_absl//absl/time",
  1261. "@com_google_googletest//:gtest_main",
  1262. ],
  1263. )
  1264. filegroup(
  1265. name = "iwyu_sh",
  1266. srcs = ["ci/travis/iwyu.sh"],
  1267. )
  1268. filegroup(
  1269. name = "extra_actions_base_proto",
  1270. srcs = [
  1271. # TODO: Replace our file with the built-in copy once this issue is resolved:
  1272. # https://github.com/bazelbuild/bazel/issues/8738
  1273. "thirdparty/protobuf/extra_actions_base.proto",
  1274. #"@bazel_tools//src/main/protobuf:extra_actions_base.proto",
  1275. ],
  1276. )
  1277. action_listener(
  1278. name = "iwyu_cpp",
  1279. extra_actions = [":iwyu_action"],
  1280. mnemonics = ["CppCompile"],
  1281. )
  1282. extra_action(
  1283. name = "iwyu_action",
  1284. cmd = "$(location :iwyu_sh) postbuild $(location @com_google_protobuf//:protoc) $(location :extra_actions_base_proto) --extra_action_file=$(EXTRA_ACTION_FILE) > $(output $(ACTION_ID).iwyu.txt)",
  1285. out_templates = [
  1286. "$(ACTION_ID).iwyu.txt",
  1287. ],
  1288. tools = [
  1289. ":extra_actions_base_proto",
  1290. ":iwyu_sh",
  1291. "@com_google_protobuf//:protoc",
  1292. ],
  1293. )
  1294. cc_library(
  1295. name = "sha256",
  1296. srcs = [
  1297. "src/ray/thirdparty/sha256.c",
  1298. ],
  1299. hdrs = [
  1300. "src/ray/thirdparty/sha256.h",
  1301. ],
  1302. copts = COPTS,
  1303. strip_include_prefix = "src",
  1304. )
  1305. alias(
  1306. name = "hiredis",
  1307. actual = "@com_github_redis_hiredis//:hiredis",
  1308. )
  1309. cc_library(
  1310. name = "redis_client",
  1311. srcs = [
  1312. "src/ray/gcs/asio.cc",
  1313. "src/ray/gcs/redis_async_context.cc",
  1314. "src/ray/gcs/redis_client.cc",
  1315. "src/ray/gcs/redis_context.cc",
  1316. ],
  1317. hdrs = [
  1318. "src/ray/gcs/asio.h",
  1319. "src/ray/gcs/redis_async_context.h",
  1320. "src/ray/gcs/redis_client.h",
  1321. "src/ray/gcs/redis_context.h",
  1322. ],
  1323. copts = COPTS,
  1324. strip_include_prefix = "src",
  1325. deps = [
  1326. ":hiredis",
  1327. ":ray_common",
  1328. ":ray_util",
  1329. ":stats_lib",
  1330. "@boost//:asio",
  1331. ],
  1332. )
  1333. cc_library(
  1334. name = "redis_store_client",
  1335. srcs = [
  1336. "src/ray/gcs/store_client/redis_store_client.cc",
  1337. ],
  1338. hdrs = [
  1339. "src/ray/gcs/callback.h",
  1340. "src/ray/gcs/store_client/redis_store_client.h",
  1341. "src/ray/gcs/store_client/store_client.h",
  1342. ],
  1343. copts = COPTS,
  1344. strip_include_prefix = "src",
  1345. deps = [
  1346. "redis_client",
  1347. ],
  1348. )
  1349. cc_library(
  1350. name = "gcs_in_memory_store_client",
  1351. srcs = [
  1352. "src/ray/gcs/store_client/in_memory_store_client.cc",
  1353. ],
  1354. hdrs = [
  1355. "src/ray/gcs/callback.h",
  1356. "src/ray/gcs/store_client/in_memory_store_client.h",
  1357. "src/ray/gcs/store_client/store_client.h",
  1358. ],
  1359. copts = COPTS,
  1360. strip_include_prefix = "src",
  1361. deps = [
  1362. ":ray_common",
  1363. ":ray_util",
  1364. ],
  1365. )
  1366. cc_library(
  1367. name = "store_client_test_lib",
  1368. hdrs = [
  1369. "src/ray/gcs/store_client/test/store_client_test_base.h",
  1370. ],
  1371. copts = COPTS,
  1372. strip_include_prefix = "src",
  1373. deps = [
  1374. "redis_store_client",
  1375. ],
  1376. )
  1377. cc_test(
  1378. name = "redis_store_client_test",
  1379. srcs = ["src/ray/gcs/store_client/test/redis_store_client_test.cc"],
  1380. args = [
  1381. "$(location redis-server)",
  1382. "$(location redis-cli)",
  1383. "$(location libray_redis_module.so)",
  1384. ],
  1385. copts = COPTS,
  1386. data = [
  1387. "//:libray_redis_module.so",
  1388. "//:redis-cli",
  1389. "//:redis-server",
  1390. ],
  1391. deps = [
  1392. ":redis_store_client",
  1393. ":store_client_test_lib",
  1394. "@com_google_googletest//:gtest_main",
  1395. ],
  1396. )
  1397. cc_test(
  1398. name = "in_memory_store_client_test",
  1399. srcs = ["src/ray/gcs/store_client/test/in_memory_store_client_test.cc"],
  1400. copts = COPTS,
  1401. deps = [
  1402. ":gcs_in_memory_store_client",
  1403. ":store_client_test_lib",
  1404. "@com_google_googletest//:gtest_main",
  1405. ],
  1406. )
  1407. cc_library(
  1408. name = "gcs",
  1409. srcs = glob(
  1410. [
  1411. "src/ray/gcs/*.cc",
  1412. ],
  1413. exclude = [
  1414. "src/ray/gcs/*_test.cc",
  1415. ],
  1416. ),
  1417. hdrs = glob([
  1418. "src/ray/gcs/*.h",
  1419. ]),
  1420. copts = COPTS,
  1421. strip_include_prefix = "src",
  1422. deps = [
  1423. ":agent_manager_rpc",
  1424. ":hiredis",
  1425. ":node_manager_fbs",
  1426. ":node_manager_rpc",
  1427. ":ray_common",
  1428. ":ray_util",
  1429. ":stats_lib",
  1430. "//src/ray/protobuf:gcs_cc_proto",
  1431. "@boost//:asio",
  1432. ],
  1433. )
  1434. # TODO(micafan) Support test group in future. Use test group we can run all gcs test once.
  1435. cc_test(
  1436. name = "redis_gcs_client_test",
  1437. srcs = ["src/ray/gcs/test/redis_gcs_client_test.cc"],
  1438. args = [
  1439. "$(location redis-server)",
  1440. "$(location redis-cli)",
  1441. "$(location libray_redis_module.so)",
  1442. ],
  1443. copts = COPTS,
  1444. data = [
  1445. "//:libray_redis_module.so",
  1446. "//:redis-cli",
  1447. "//:redis-server",
  1448. ],
  1449. deps = [
  1450. ":gcs",
  1451. "@com_google_googletest//:gtest_main",
  1452. ],
  1453. )
  1454. cc_test(
  1455. name = "redis_actor_info_accessor_test",
  1456. srcs = ["src/ray/gcs/test/redis_actor_info_accessor_test.cc"],
  1457. args = [
  1458. "$(location redis-server)",
  1459. "$(location redis-cli)",
  1460. "$(location libray_redis_module.so)",
  1461. ],
  1462. copts = COPTS,
  1463. data = [
  1464. "//:libray_redis_module.so",
  1465. "//:redis-cli",
  1466. "//:redis-server",
  1467. ],
  1468. deps = [
  1469. ":gcs",
  1470. ":gcs_test_util_lib",
  1471. "@com_google_googletest//:gtest_main",
  1472. ],
  1473. )
  1474. cc_test(
  1475. name = "redis_object_info_accessor_test",
  1476. srcs = ["src/ray/gcs/test/redis_object_info_accessor_test.cc"],
  1477. args = [
  1478. "$(location redis-server)",
  1479. "$(location redis-cli)",
  1480. "$(location libray_redis_module.so)",
  1481. ],
  1482. copts = COPTS,
  1483. data = [
  1484. "//:libray_redis_module.so",
  1485. "//:redis-cli",
  1486. "//:redis-server",
  1487. ],
  1488. deps = [
  1489. ":gcs",
  1490. ":gcs_test_util_lib",
  1491. "@com_google_googletest//:gtest_main",
  1492. ],
  1493. )
  1494. cc_test(
  1495. name = "subscription_executor_test",
  1496. srcs = ["src/ray/gcs/test/subscription_executor_test.cc"],
  1497. args = [
  1498. "$(location redis-server)",
  1499. "$(location redis-cli)",
  1500. "$(location libray_redis_module.so)",
  1501. ],
  1502. copts = COPTS,
  1503. data = [
  1504. "//:libray_redis_module.so",
  1505. "//:redis-cli",
  1506. "//:redis-server",
  1507. ],
  1508. deps = [
  1509. ":gcs",
  1510. ":gcs_test_util_lib",
  1511. "@com_google_googletest//:gtest_main",
  1512. ],
  1513. )
  1514. cc_test(
  1515. name = "redis_job_info_accessor_test",
  1516. srcs = ["src/ray/gcs/test/redis_job_info_accessor_test.cc"],
  1517. args = [
  1518. "$(location redis-server)",
  1519. "$(location redis-cli)",
  1520. "$(location libray_redis_module.so)",
  1521. ],
  1522. copts = COPTS,
  1523. data = [
  1524. "//:libray_redis_module.so",
  1525. "//:redis-cli",
  1526. "//:redis-server",
  1527. ],
  1528. deps = [
  1529. ":gcs",
  1530. ":gcs_test_util_lib",
  1531. "@com_google_googletest//:gtest_main",
  1532. ],
  1533. )
  1534. cc_test(
  1535. name = "redis_node_info_accessor_test",
  1536. srcs = ["src/ray/gcs/test/redis_node_info_accessor_test.cc"],
  1537. args = [
  1538. "$(location redis-server)",
  1539. "$(location redis-cli)",
  1540. "$(location libray_redis_module.so)",
  1541. ],
  1542. copts = COPTS,
  1543. data = [
  1544. "//:libray_redis_module.so",
  1545. "//:redis-cli",
  1546. "//:redis-server",
  1547. ],
  1548. deps = [
  1549. ":gcs",
  1550. ":gcs_test_util_lib",
  1551. "@com_google_googletest//:gtest_main",
  1552. ],
  1553. )
  1554. cc_test(
  1555. name = "asio_test",
  1556. srcs = ["src/ray/gcs/test/asio_test.cc"],
  1557. args = [
  1558. "$(location redis-server)",
  1559. "$(location redis-cli)",
  1560. "$(location libray_redis_module.so)",
  1561. ],
  1562. copts = COPTS,
  1563. data = [
  1564. "//:libray_redis_module.so",
  1565. "//:redis-cli",
  1566. "//:redis-server",
  1567. ],
  1568. deps = [
  1569. ":gcs",
  1570. ":ray_util",
  1571. "@com_google_googletest//:gtest_main",
  1572. ],
  1573. )
  1574. flatbuffer_cc_library(
  1575. name = "node_manager_fbs",
  1576. srcs = ["src/ray/raylet/format/node_manager.fbs"],
  1577. flatc_args = FLATC_ARGS,
  1578. out_prefix = "ray/raylet/format/",
  1579. )
  1580. flatbuffer_cc_library(
  1581. name = "object_manager_fbs",
  1582. srcs = ["src/ray/object_manager/format/object_manager.fbs"],
  1583. flatc_args = FLATC_ARGS,
  1584. out_prefix = "src/ray/object_manager/format/",
  1585. )
  1586. pyx_library(
  1587. name = "_raylet",
  1588. srcs = glob([
  1589. "python/ray/__init__.py",
  1590. "python/ray/_raylet.pxd",
  1591. "python/ray/_raylet.pyx",
  1592. "python/ray/includes/*.pxd",
  1593. "python/ray/includes/*.pxi",
  1594. ]),
  1595. # Export ray ABI symbols, which can then be used by _streaming.so.
  1596. # We need to dlopen this lib with RTLD_GLOBAL to use ABI in this
  1597. # shared lib, see python/ray/__init__.py.
  1598. cc_kwargs = dict(
  1599. srcs = PYX_SRCS,
  1600. copts = COPTS + PYX_COPTS,
  1601. # see https://github.com/tensorflow/tensorflow/blob/r2.1/tensorflow/lite/BUILD#L444
  1602. linkopts = select({
  1603. "@bazel_tools//src/conditions:darwin": [
  1604. "-Wl,-exported_symbols_list,$(location //:src/ray/ray_exported_symbols.lds)",
  1605. ],
  1606. "@bazel_tools//src/conditions:windows": [
  1607. ],
  1608. "//conditions:default": [
  1609. "-Wl,--version-script,$(location //:src/ray/ray_version_script.lds)",
  1610. ],
  1611. }),
  1612. linkstatic = 1,
  1613. ),
  1614. deps = [
  1615. "//:core_worker_lib",
  1616. "//:exported_streaming_internal",
  1617. "//:global_state_accessor_lib",
  1618. "//:ray_util",
  1619. "//:raylet_lib",
  1620. "//:src/ray/ray_exported_symbols.lds",
  1621. "//:src/ray/ray_version_script.lds",
  1622. "//:stats_lib",
  1623. "//src/ray/protobuf:serialization_cc_proto",
  1624. ],
  1625. )
  1626. pyx_library(
  1627. name = "_streaming",
  1628. srcs = glob([
  1629. "python/ray/streaming/_streaming.pyx",
  1630. "python/ray/__init__.py",
  1631. "python/ray/_raylet.pxd",
  1632. "python/ray/includes/*.pxd",
  1633. "python/ray/includes/*.pxi",
  1634. "python/ray/streaming/__init__.pxd",
  1635. "python/ray/streaming/includes/*.pxd",
  1636. "python/ray/streaming/includes/*.pxi",
  1637. ]),
  1638. cc_kwargs = dict(
  1639. srcs = PYX_SRCS,
  1640. copts = COPTS + PYX_COPTS,
  1641. ),
  1642. deps = [
  1643. "//streaming:streaming_lib",
  1644. ],
  1645. )
  1646. cc_binary(
  1647. name = "libcore_worker_library_java.so",
  1648. srcs = glob([
  1649. "src/ray/core_worker/lib/java/*.h",
  1650. "src/ray/core_worker/lib/java/*.cc",
  1651. ]),
  1652. copts = COPTS,
  1653. # Export ray ABI symbols, which can then be used by libstreaming_java.so. see `//:_raylet`
  1654. linkopts = select({
  1655. "@bazel_tools//src/conditions:darwin": [
  1656. "-Wl,-exported_symbols_list,$(location //:src/ray/ray_exported_symbols.lds)",
  1657. ],
  1658. "@bazel_tools//src/conditions:windows": [
  1659. ],
  1660. "//conditions:default": [
  1661. "-Wl,--version-script,$(location //:src/ray/ray_version_script.lds)",
  1662. ],
  1663. }),
  1664. linkshared = 1,
  1665. linkstatic = 1,
  1666. visibility = ["//java:__subpackages__"],
  1667. deps = [
  1668. "//:core_worker_lib",
  1669. "//:exported_streaming_internal",
  1670. "//:global_state_accessor_lib",
  1671. "//:src/ray/ray_exported_symbols.lds",
  1672. "//:src/ray/ray_version_script.lds",
  1673. "//:stats_lib",
  1674. "@bazel_tools//tools/jdk:jni",
  1675. ],
  1676. )
  1677. filegroup(
  1678. name = "python_sources",
  1679. srcs = glob([
  1680. "python/ray/*.py",
  1681. "python/ray/autoscaler/*.py",
  1682. "python/ray/autoscaler/aws/example-full.yaml",
  1683. "python/ray/autoscaler/azure/example-full.yaml",
  1684. "python/ray/autoscaler/gcp/example-full.yaml",
  1685. "python/ray/autoscaler/local/example-full.yaml",
  1686. "python/ray/cloudpickle/*.py",
  1687. "python/ray/core/__init__.py",
  1688. "python/ray/core/generated/__init__.py",
  1689. "python/ray/core/generated/ray/__init__.py",
  1690. "python/ray/core/generated/ray/protocol/__init__.py",
  1691. "python/ray/dashboard/*.py",
  1692. "python/ray/dashboard/metrics_exporter/*.py",
  1693. "python/ray/experimental/*.py",
  1694. "python/ray/util/*.py",
  1695. "python/ray/internal/*.py",
  1696. "python/ray/workers/default_worker.py",
  1697. ]),
  1698. )
  1699. alias(
  1700. name = "redis-server",
  1701. actual = select({
  1702. "@bazel_tools//src/conditions:windows": "@com_github_tporadowski_redis_bin//:redis-server.exe",
  1703. "//conditions:default": "@com_github_antirez_redis//:redis-server",
  1704. }),
  1705. visibility = ["//visibility:public"],
  1706. )
  1707. alias(
  1708. name = "redis-cli",
  1709. actual = select({
  1710. "@bazel_tools//src/conditions:windows": "@com_github_tporadowski_redis_bin//:redis-cli.exe",
  1711. "//conditions:default": "@com_github_antirez_redis//:redis-cli",
  1712. }),
  1713. visibility = ["//visibility:public"],
  1714. )
  1715. cc_library(
  1716. name = "ray_redis_module",
  1717. hdrs = [
  1718. "src/ray/gcs/redis_module/redis_string.h",
  1719. "src/ray/gcs/redis_module/redismodule.h",
  1720. ],
  1721. copts = COPTS,
  1722. strip_include_prefix = "src",
  1723. )
  1724. cc_binary(
  1725. name = "libray_redis_module.so",
  1726. srcs = [
  1727. "src/ray/gcs/redis_module/ray_redis_module.cc",
  1728. ],
  1729. copts = COPTS,
  1730. linkshared = 1,
  1731. linkstatic = 1,
  1732. visibility = ["//java:__subpackages__"],
  1733. deps = [
  1734. ":ray_common",
  1735. ":ray_redis_module",
  1736. "//src/ray/protobuf:gcs_cc_proto",
  1737. ],
  1738. )
  1739. filegroup(
  1740. name = "all_py_proto",
  1741. srcs = [
  1742. "//src/ray/protobuf:agent_manager_py_proto",
  1743. "//src/ray/protobuf:common_py_proto",
  1744. "//src/ray/protobuf:core_worker_py_proto",
  1745. "//src/ray/protobuf:gcs_py_proto",
  1746. "//src/ray/protobuf:gcs_service_py_proto",
  1747. "//src/ray/protobuf:node_manager_py_proto",
  1748. "//src/ray/protobuf:reporter_py_proto",
  1749. ],
  1750. )
  1751. # This is a dummy test dependency that causes the python tests to be
  1752. # re-run if any of these files changes.
  1753. py_library(
  1754. name = "ray_lib",
  1755. srcs = glob(
  1756. ["python/ray/**/*.py"],
  1757. exclude = ["python/ray/tests/*.py"],
  1758. ),
  1759. visibility = ["__subpackages__"],
  1760. )
  1761. copy_to_workspace(
  1762. name = "cp_raylet_so",
  1763. srcs = ["python/ray/_raylet.so"],
  1764. dstdir = "python/ray",
  1765. )
  1766. copy_to_workspace(
  1767. name = "cp_streaming",
  1768. srcs = ["python/ray/streaming/_streaming.so"],
  1769. dstdir = "python/ray/streaming",
  1770. )
  1771. copy_to_workspace(
  1772. name = "cp_all_py_proto",
  1773. srcs = [":all_py_proto"],
  1774. dstdir = "python/ray/core/generated",
  1775. )
  1776. copy_to_workspace(
  1777. name = "cp_redis",
  1778. srcs = [
  1779. ":redis-cli",
  1780. ":redis-server",
  1781. ],
  1782. dstdir = "python/ray/core/src/ray/thirdparty/redis/src",
  1783. )
  1784. copy_to_workspace(
  1785. name = "cp_libray_redis_module",
  1786. srcs = [":libray_redis_module.so"],
  1787. dstdir = "python/ray/core/src/ray/gcs/redis_module",
  1788. )
  1789. copy_to_workspace(
  1790. name = "cp_raylet",
  1791. srcs = [":raylet"],
  1792. dstdir = "python/ray/core/src/ray/raylet",
  1793. )
  1794. copy_to_workspace(
  1795. name = "cp_gcs_server",
  1796. srcs = [":gcs_server"],
  1797. dstdir = "python/ray/core/src/ray/gcs",
  1798. )
  1799. copy_to_workspace(
  1800. name = "cp_plasma_store_server",
  1801. srcs = [":plasma_store_server"],
  1802. dstdir = "python/ray/core/src/plasma",
  1803. )
  1804. genrule(
  1805. name = "ray_pkg",
  1806. srcs = [
  1807. ":cp_raylet_so",
  1808. ":cp_streaming",
  1809. ":python_sources",
  1810. ":cp_all_py_proto",
  1811. ":cp_redis",
  1812. ":cp_libray_redis_module",
  1813. ":cp_raylet",
  1814. ":cp_gcs_server",
  1815. ":cp_plasma_store_server",
  1816. "//streaming:copy_streaming_py_proto",
  1817. ],
  1818. outs = ["ray_pkg.out"],
  1819. cmd = """
  1820. if [ "$${OSTYPE-}" = "msys" ]; then
  1821. ln -P -f -- python/ray/_raylet.so python/ray/_raylet.pyd
  1822. fi
  1823. # NOTE(hchen): Protobuf doesn't allow specifying Python package name. So we use this `sed`
  1824. # command to change the import path in the generated file.
  1825. # shellcheck disable=SC2006
  1826. files=(`ls python/ray/core/generated/*_pb2*.py`)
  1827. sed -i -E 's/from src.ray.protobuf/from ./' "$${files[@]}"
  1828. sed -i -E 's/from opencensus.proto.metrics.v1 import/from . import/' "$${files[@]}"
  1829. sed -i -E 's/from opencensus.proto.resource.v1 import/from . import/' "$${files[@]}"
  1830. echo "$${PWD}" > $@
  1831. """,
  1832. local = 1,
  1833. )