Failed to parse value [4] for setting [thread_pool.write.size] must be <= 2
时间: 2023-12-10 19:36:50 浏览: 50
这个错误提示是 Elasticsearch 的设置错误。它告诉我们,`thread_pool.write.size` 的值必须小于或等于 2。这个设置控制了写入操作的线程池中的线程数。如果你想要修改这个设置,可以通过在 Elasticsearch 的配置文件中设置 `thread_pool.write.size` 来实现。例如,将其设置为 2:
```
thread_pool.write.size: 2
```
如果你已经设置了这个值,但仍然出现这个错误,那么可能是由于其他设置引起的冲突。你可以参考 Elasticsearch 的官方文档,查找可能会影响该设置的其他设置,并进行相应的修改。
相关问题
Elasticsearch exception [type=illegal_argument_exception, reason=Failed to parse value [0] for setting [index.number_of_shards] must be >= 1
这个错误意味着在Elasticsearch中,索引的分片数需要大于等于1,但是你设置的值为0或负数了。你需要将index.number_of_shards的值修改为大于等于1的整数值,例如:
PUT /my_index
{
"settings": {
"index.number_of_shards": 1
}
}
这样就可以将分片数设置为1了。如果你需要更多的分片,可以适当增加这个值。
规范代码:读取数据源表格 ori_excel = openpyxl.load_workbook(ori_excel_path) ori_sheet = ori_excel.active rows = ori_sheet.max_row cols = ori_sheet.max_column 加载公式解析器 from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("microsoft/CodeGPT-small-py") 遍历每一行 for r in range(2, rows + 1): info = {} # 定义一个字典用来存放数据 mould_excel = openpyxl.load_workbook(mould_excel_path) mould_sheet = mould_excel.active # 遍历每一列 for c in range(1, cols + 1): # 如果标题栏和单元格内有内容 ori_cell_value = ori_sheet.cell(1, c).value cell_value = ori_sheet.cell(r, c).value if ori_cell_value and cell_value: # 获取单元格数据类型和值 data_type = ori_sheet.cell(r, c).data_type value = cell_value # 如果单元格内是函数公式,则运算后写入 if data_type == 'f': # 公式解析 tokens = [str(token.value) if token.type == Token.NUMBER else repr(token.value) for token in tokenizer.parse(value)] # 运算 result = calculate(tokens) # 写入结果 mould_sheet.cell(row=r, column=c).value = result else: # 直接写入值 mould_sheet.cell(row=r, column=c).value = value # 将计算结果写入到模板表格 if data_type == 'f': mould_sheet.cell(row=r, column=c, value=result) else: mould_sheet.cell(row=r, column=c, value=value) else: # 如果单元格内不是函数公式,则直接写入 info[ori_cell_value] = cell_value mould_sheet.cell(row=r, column=c, value=cell_value)
下面是规范化后的代码:
```python
import openpyxl
from transformers import AutoTokenizer
# 读取数据源表格
ori_excel = openpyxl.load_workbook(ori_excel_path)
ori_sheet = ori_excel.active
rows = ori_sheet.max_row
cols = ori_sheet.max_column
# 加载公式解析器
tokenizer = AutoTokenizer.from_pretrained("microsoft/CodeGPT-small-py")
# 遍历每一行
for r in range(2, rows + 1):
info = {}
# 定义一个字典用来存放数据
mould_excel = openpyxl.load_workbook(mould_excel_path)
mould_sheet = mould_excel.active
# 遍历每一列
for c in range(1, cols + 1):
# 如果标题栏和单元格内有内容
ori_cell_value = ori_sheet.cell(1, c).value
cell_value = ori_sheet.cell(r, c).value
if ori_cell_value and cell_value:
# 获取单元格数据类型和值
data_type = ori_sheet.cell(r, c).data_type
value = cell_value
# 如果单元格内是函数公式,则运算后写入
if data_type == 'f':
# 公式解析
tokens = [str(token.value) if token.type == Token.NUMBER else repr(token.value) for token in tokenizer.parse(value)]
# 运算
result = calculate(tokens)
# 写入结果
mould_sheet.cell(row=r, column=c).value = result
else:
# 直接写入值
mould_sheet.cell(row=r, column=c).value = value
# 将计算结果写入到模板表格
if data_type == 'f':
mould_sheet.cell(row=r, column=c, value=result)
else:
mould_sheet.cell(row=r, column=c, value=value)
else:
# 如果单元格内不是函数公式,则直接写入
info[ori_cell_value] = cell_value
mould_sheet.cell(row=r, column=c, value=cell_value)
```