我有一个基本的节点应用程序,我已将其包装在 Dockerfile 中
FROM node:lts-alpine3.15
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "npm", "run", "serve" ]
Run Code Online (Sandbox Code Playgroud)
我将其推送到 Gitlab 的容器注册表。我正在尝试将其从那里部署到 AWS,但在 ECS 端遇到问题。在 ECS 中我有:
两者都是在 terraform 中配置的
resource "aws_ecs_cluster" "frontend" {
name = "frontend"
setting {
name = "containerInsights"
value = "enabled"
}
}
resource "aws_ecs_service" "frontend" {
name = "frontend"
cluster = aws_ecs_cluster.frontend.id
deployment_controller {
type = "EXTERNAL"
}
tags = {
Name = "WebAppFrontend"
}
}
Run Code Online (Sandbox Code Playgroud)
Web 应用程序位于与 …
我有一个看起来像这样的元组
full = [('Ethernet4/3', 'odsa', 'connected'),('Port-Channel161', 'odsa', 'connected'),('Port-Channel545', 'odsa', 'connected')]
Run Code Online (Sandbox Code Playgroud)
我想删除所有Port-Channels以仅返回接口.我可以在列表中硬编码每个Port-Channel并以这种方式删除它,但这不是很可扩展.我正试图从列表中删除任何带有"Port"的内容,所以我的脚本看起来像这样
full = [('Ethernet4/3', 'odsa', 'connected'),('Port-Channel161', 'odsa', 'connected')]
skip_interfaces = ['Ethernet49/1', 'Ethernet49/2', 'Ethernet49/3', 'Ethernet49/4', 'Ethernet50/1', 'Ethernet50/2', 'Ethernet50/3','Ethernet50/4','Ethernet51/1',
'Ethernet51/2', 'Ethernet51/3', 'Ethernet51/4', 'Ethernet52/1', 'Ethernet52/2', 'Ethernet52/3', 'Ethernet52/4', 'Port', 'Management1', 'Port-Channel44', 'Port-Channel34']
new = [tup for tup in full if tup[0] not in skip_interfaces]
print new
Run Code Online (Sandbox Code Playgroud)
但是当打印出来时我仍然会得到
[('Ethernet4/3', 'odsa', 'connected'),('Port-Channel161', 'odsa', 'connected'),('Port-Channel545', 'odsa', 'connected')]
Run Code Online (Sandbox Code Playgroud)
当子字符串在列表中时,是否有更好的方法从元组中删除项目?
谢谢
我正在绘制一个谷歌折线图,它工作正常。该图表将绘制正确的数据。但是,当我更改curveType的选项时,“功能”选项不会将图表从直线更改为曲线。此外,动画功能完全不起作用。我在这里想念什么吗?这是我的代码:
google.charts.load('current', {
'packages': ['line']
});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Number']
, ['2005', 61372]
, ['2006', 65425]
, ['2007', 71389]
, ['2008', 75173]
, ['2009', 75554]
, ['2010', 75174]
, ['2011', 74033]
, ['2012', 72225]
, ['2013', 68954]
, ['2014', 67462]
, ])
};
var options = {
animation:{
duration: 1000,
easing: 'out',
}, curveType: 'function'
, smoothline: 'true'
, width: 875
, height: 400
, legend: {position: 'none'}
};
var chart = new google.charts.Line(document.getElementById('number_chart')); …Run Code Online (Sandbox Code Playgroud) 我有一个.xlsx基本格式为多张纸(sheet1、sheet2、sheet3)的文件
Col1 | Col2 | Col3 | Col4 | Col5
abc1 | abc2 | abc3 | abc4 | abc5
Run Code Online (Sandbox Code Playgroud)
列数不同的地方。我希望能够根据给定的工作表名称编写新的工作表。目前我有:
import openpyxl
def get_sheets():
wb = openpyxl.load_workbook('C:/Users/mydir/Desktop/myfile.xlsx')
sheets = wb.get_sheet_names()
sheet3 = "Sheet3"
sheet4 = "Sheet4"
for i in sheets:
if i == sheet3:
# Write column
elif i == sheet4:
# Write column in different sheet
else:
continue
def main():
get_sheets()
print
print "Script finished."
if __name__ == "__main__":
main()
Run Code Online (Sandbox Code Playgroud)
openpyxl 是否允许将新列写入现有的 xlsx 文件,其标题和行数等于标题后的行数?
我有一张像这样的地图
variable "mysubnets" {
type = map(string)
default = {
"subnet1" = "10.1.0.0/24"
"subnet2" = "10.1.1.0/24"
}
}
Run Code Online (Sandbox Code Playgroud)
在我的模块中,我尝试将子网放置在同一 vpc 的不同可用区中
data "aws_availability_zones" "azs" {
state = "available"
}
resource "aws_subnet" "test-subnets" {
for_each = var.mysubnets
cidr_block = "${each.value}"
vpc_id = aws_vpc.myvpc.id
availability_zone = data.aws_availability_zones.azs.names[index("${each.value}")]
tags = {
Name = "${each.key}"
}
}
Run Code Online (Sandbox Code Playgroud)
我可以从地图中获取键和值,没有问题,但是当尝试选择可用区域时,我找不到如何更改值。有没有办法获取地图的索引,或者为递增的数字创建一个计数器?
我的正则表达是可怕的.我有列表项看起来像这样
device = ['1U1abc']
device = ['18U12def']
Run Code Online (Sandbox Code Playgroud)
我想将项目分开,看起来像这样
device = ['1','U1','abc']
device = ['18','U12','def']
Run Code Online (Sandbox Code Playgroud)
所以我有一个条目中第一个数字的条目,带有字母和数字的代码,以及包含所有字母的第二个代码.正则表达式是一个很好的方法来获得这个?
python ×3
amazon-ecs ×1
docker ×1
javascript ×1
list ×1
openpyxl ×1
regex ×1
terraform ×1
tuples ×1
xlsx ×1