我有一种情况需要让delayed_job在单独的数据库/表上使用自定义后端。
所以基本上强迫它使用单独的架构而不是我的应用主要使用的架构。
关于如何做到这一点的任何想法?提前谢谢。
答案 0 :(得分:0)
你可以让你的一些模型连接到不同的数据库并使用不同的表。
在database.yml
delayed_jobs_db_connection:
adapter: mysql # or any other adapter
database: delayed_jobs_db
username: root
password:
host: localhost
在模型中,我们将使用establish_connection
建立与此数据库的连接。您还可以直接在模型中指定所有配置,将其保留在配置中只是一种更好的方法。希望这会有所帮助。
答案 1 :(得分:0)
我知道这个问题已经问了很久了,但是我也面临着同样的挑战,这种简单的方法对我有用:
只需添加到文件顶部:
n: 10000000
sum_x: 10007209.0488715283572674
sum_x2: 20023758.8835431151092052
avg_x: 1.0007209048871528
sdev_x: 1.0004667205707121
min_x: 0.0000002696179218
max_x: 17.2248827198513297
below_A: 0
[0.0000000000000000, 0.2000000000000000]1811635
[0.2000000000000000, 0.4000000000000000]1484598: 0.8194796413184775
[0.4000000000000000, 0.6000000000000001]1213219: 0.8172037144061894
[0.6000000000000001, 0.8000000000000000]994937: 0.8200802987754066
[0.8000000000000000, 1.0000000000000000]813669: 0.8178095698521615
[1.0000000000000000, 1.2000000000000000]666035: 0.8185576690275775
[1.2000000000000000, 1.3999999999999999]545997: 0.8197722341918968
[1.3999999999999999, 1.5999999999999999]447841: 0.8202261184585263
[1.5999999999999999, 1.7999999999999998]365854: 0.8169283294740768
[1.7999999999999998, 1.9999999999999998]300525: 0.8214342333280489
[1.9999999999999998, 2.1999999999999997]246141: 0.8190366857998502
[2.1999999999999997, 2.3999999999999999]201303: 0.8178361183224250
[2.3999999999999999, 2.6000000000000001]164134: 0.8153579430013462
[2.6000000000000001, 2.8000000000000003]134768: 0.8210852108642938
[2.8000000000000003, 3.0000000000000004]110564: 0.8204024694289446
[3.0000000000000004, 3.2000000000000006] 90139: 0.8152653666654607
[3.2000000000000006, 3.4000000000000008] 74252: 0.8237499861325287
[3.4000000000000008, 3.6000000000000010] 60746: 0.8181059096051285
[3.6000000000000010, 3.8000000000000012] 49701: 0.8181773285483818
[3.8000000000000012, 4.0000000000000009] 40559: 0.8160600390334198
[4.0000000000000009, 4.2000000000000011] 33344: 0.8221109987918834
[4.2000000000000011, 4.4000000000000012] 27077: 0.8120501439539347
[4.4000000000000012, 4.6000000000000014] 22338: 0.8249806108505373
[4.6000000000000014, 4.8000000000000016] 18370: 0.8223654758707136
[4.8000000000000016, 5.0000000000000018] 15016: 0.8174197060424605
...