pytest中文使用文档----12缓存:记录执行的状态

  • 1. cacheprovider插件
    • 1.1. --lf, --last-failed:只执行上一轮失败的用例
    • 1.2. --ff, --failed-first:先执行上一轮失败的用例,再执行其它的
    • 1.3. --nf, --new-first:先执行新加的或修改的用例,再执行其它的
    • 1.4. --cache-clear:先清除所有缓存,再执行用例
    • 1.5. 如果上一轮没有失败的用例
  • 2. config.cache对象
  • 3. Stepwise

pytest会将本轮测试的执行状态写入到.pytest_cache文件夹,这个行为是由自带的cacheprovider插件来实现的;

注意:

pytest默认将测试执行的状态写入到根目录中的.pytest_cache文件夹,我们也可以通过在pytest.ini中配置cache_dir选项来自定义缓存的目录,它可以是相对路径,也可以是绝对路径;

相对路径指的是相对于pytest.ini文件所在的目录;例如,我们把这一章的缓存和源码放在一起:

src/chapter-12/pytest.ini中添加如下配置:

[pytest]
cache_dir = .pytest-cache

这样,即使我们在项目的根目录下执行src/chapter-12/中的用例,也只会在pytest-chinese-doc/src/chapter-12/.pytest_cache中生成缓存,而不再是pytest-chinese-doc/.pytest_cache中;

pytest-chinese-doc (5.1.3) 
λ pytest src/chapter-12

1. cacheprovider插件

在介绍这个插件之前,我们先看一个简单例子:

# src/chapter-12/test_failed.pyimport pytest@pytest.mark.parametrize('num', [1, 2])
def test_failed(num):assert num == 1# src\chapter-12\test_pass.pydef test_pass():assert 1

我们有两个简单的测试模块,首先我们来执行一下它们:

λ pytest -q src/chapter-12/
.F.                                                                [100%] 
=============================== FAILURES ================================ 
____________________________ test_failed[2] _____________________________num = 2@pytest.mark.parametrize('num', [1, 2])def test_failed(num):
>       assert num == 1
E       assert 2 == 1src\chapter-12\test_failed.py:27: AssertionError
1 failed, 2 passed in 0.08s

可以看到一共收集到三个测试用例,其中有一个失败,另外两个成功的,并且两个执行成功的用例分属不同的测试模块;

同时,pytest也在src/chapter-12/的目录下生成缓存文件夹(.pytest_cache),具体的目录结构如下所示:

src
├───chapter-12
│   │   pytest.ini  # 配置了 cache_dir = .pytest-cache
│   │   test_failed.py
│   │   test_pass.py
│   │
│   └───.pytest-cache
│       │   .gitignore
│       │   CACHEDIR.TAG
│       │   README.md
│       │
│       └───v
│           └───cache
│                   lastfailed
│                   nodeids
│                   stepwise

现在,我们就结合上面的组织结构,具体介绍一下cacheprovider插件的功能;

1.1. --lf, --last-failed:只执行上一轮失败的用例

缓存中的lastfailed文件记录了上次失败的用例ID,我们可以通过一下--cache-show命令查看它的内容:

--cache-show命令也是cacheprovider提供的新功能,它不会导致任何用例的执行;

λ pytest src/chapter-12/ -q --cache-show 'lastfailed'
cachedir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12\.pytest-cache
--------------------- cache values for 'lastfailed' --------------------- 
cache\lastfailed contains:{'test_failed.py::test_failed[2]': True}no tests ran in 0.01s

我们可以看到,它记录了一个用例,为上次失败的测试用例的IDtest_failed.py::test_failed[2]

下次执行时,当我们使用--lf选项,pytest在收集阶段只会选择这个失败的用例,而忽略其它的:

λ pytest --lf --collect-only src/chapter-12/
========================== test session starts ==========================
platform win32 -- Python 3.7.3, pytest-5.1.3, py-1.8.0, pluggy-0.13.0
cachedir: .pytest-cache
rootdir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12, inifile: pytest.ini
collected 2 items / 1 deselected / 1 selected
<Module test_failed.py><Function test_failed[2]>
run-last-failure: rerun previous 1 failure (skipped 2 files)========================= 1 deselected in 0.02s =========================

我们仔细观察一下上面的回显,有一句话可能会让我们有点困惑:collected 2 items / 1 deselected / 1 selected,可我们明明有三个用例,怎么会只收集到两个呢?

实际上,--lf复写了用例收集阶段的两个钩子方法:pytest_ignore_collect(path, config)pytest_collection_modifyitems(session, config, items)

我们来先看看pytest_ignore_collect(path, config),如果它的结果返回True,就忽略path路径中的用例;

# _pytest/cacheprovider.pydef last_failed_paths(self):"""Returns a set with all Paths()s of the previously failed nodeids (cached)."""try:return self._last_failed_pathsexcept AttributeError:rootpath = Path(self.config.rootdir)result = {rootpath / nodeid.split("::")[0] for nodeid in self.lastfailed}result = {x for x in result if x.exists()}self._last_failed_paths = resultreturn resultdef pytest_ignore_collect(self, path):"""Ignore this file path if we are in --lf mode and it is not in the list ofpreviously failed files."""if self.active and self.config.getoption("lf") and path.isfile():last_failed_paths = self.last_failed_paths()if last_failed_paths:skip_it = Path(path) not in self.last_failed_paths()if skip_it:self._skipped_files += 1return skip_it

可以看到,如果当前收集的文件,不在上一次失败的路径集合内,就会忽略这个文件,所以这次执行就不会到test_pass.py中收集用例了,故而只收集到两个用例;并且pytest.ini也在忽略的名单上,所以实际上是跳过两个文件:(skipped 2 files)

至于pytest_collection_modifyitems(session, config, items)钩子方法,我们在下一节和--ff命令一起看;

1.2. --ff, --failed-first:先执行上一轮失败的用例,再执行其它的

我们先通过实践看看这个命令的效果,再去分析它的实现:

λ pytest --collect-only -s --ff src/chapter-12/
========================== test session starts ========================== 
platform win32 -- Python 3.7.3, pytest-5.1.3, py-1.8.0, pluggy-0.13.0
cachedir: .pytest-cache
rootdir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12, inifile: pytest.ini
collected 3 items
<Module test_failed.py><Function test_failed[2]><Function test_failed[1]>
<Module test_pass.py><Function test_pass>
run-last-failure: rerun previous 1 failure first========================= no tests ran in 0.02s =========================

我们可以看到一共收集到三个测试用例,和正常的收集顺序相比,上一轮失败的test_failed.py::test_failed[2]用例在最前面,将优先执行;

实际上,-ff只复写了钩子方法:pytest_collection_modifyitems(session, config, items),它可以过滤或者重新排序收集到的用例:

# _pytest/cacheprovider.pydef pytest_collection_modifyitems(self, session, config, items):...if self.config.getoption("lf"):items[:] = previously_failedconfig.hook.pytest_deselected(items=previously_passed)else:  # --failedfirstitems[:] = previously_failed + previously_passed...

可以看到,如果使用的是lf,就把之前成功的用例状态置为deselected,这轮执行就会忽略它们;如果使用的是-ff,只是将之前失败的用例,顺序调到前面;

另外,我们也可以看到lf的优先级要高于ff,所以它们同时使用的话,ff是不起作用的;

1.3. --nf, --new-first:先执行新加的或修改的用例,再执行其它的

缓存中的nodeids文件记录了上一轮执行的所有的用例:

λ pytest src/chapter-12 --cache-show 'nodeids'
========================== test session starts ==========================
platform win32 -- Python 3.7.3, pytest-5.1.3, py-1.8.0, pluggy-0.13.0
cachedir: .pytest-cache
rootdir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12, inifile: pytest.ini
cachedir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12\.pytest-cache
---------------------- cache values for 'nodeids' -----------------------
cache\nodeids contains:['test_failed.py::test_failed[1]','test_failed.py::test_failed[2]','test_pass.py::test_pass']========================= no tests ran in 0.01s =========================

我们看到上一轮共执行了三个测试用例;

现在我们在test_pass.py中新加一个用例,并修改一下test_failed.py文件中的用例(但是不添加新用例):

# src\chapter-12\test_pass.pydef test_pass():assert 1def test_new_pass():assert 1

现在我们再来执行一下收集命令:

λ pytest --collect-only -s --nf src/chapter-12/
========================== test session starts ==========================
platform win32 -- Python 3.7.3, pytest-5.1.3, py-1.8.0, pluggy-0.13.0
cachedir: .pytest-cache
rootdir: D:\Personal Files\Projects\pytest-chinese-doc\src\chapter-12, inifile: pytest.ini
collected 4 items
<Module test_pass.py><Function test_new_pass>
<Module test_failed.py><Function test_failed[1]><Function test_failed[2]>
<Module test_pass.py><Function test_pass>========================= no tests ran in 0.03s =========================

可以看到,新加的用例顺序在最前面,其次修改过的测试用例紧接其后,最后才是旧的用例;这个行为在源码中有所体现:

# _pytest/cacheprovider.pydef pytest_collection_modifyitems(self, session, config, items):if self.active:new_items = OrderedDict()other_items = OrderedDict()for item in items:if item.nodeid not in self.cached_nodeids:new_items[item.nodeid] = itemelse:other_items[item.nodeid] = itemitems[:] = self._get_increasing_order(new_items.values()) + self._get_increasing_order(other_items.values())self.cached_nodeids = [x.nodeid for x in items if isinstance(x, pytest.Item)]def _get_increasing_order(self, items):return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)

item.fspath.mtime()代表用例所在文件的最后修改时间,reverse=True表明是倒序排列;

items[:] = self._get_increasing_order(new_items.values()) + self._get_increasing_order(other_items.values())保证新加的用例永远在最前面;

1.4. --cache-clear:先清除所有缓存,再执行用例

直接看源码:

# _pytest/cacheprovider.pyclass Cache:... @classmethoddef for_config(cls, config):cachedir = cls.cache_dir_from_config(config)if config.getoption("cacheclear") and cachedir.exists():rm_rf(cachedir)cachedir.mkdir()return cls(cachedir, config)

可以看到,它会先把已有的缓存文件夹删除(rm_rf(cachedir)),再创建一个空的同名文件夹(cachedir.mkdir()),这样会导致上述的功能失效,所以一般不使用这个命令;

1.5. 如果上一轮没有失败的用例

现在,我们清除缓存,再执行test_pass.py模块(它的用例都是能测试成功的):

λ pytest --cache-clear -q -s src/chapter-12/test_pass.py
.
1 passed in 0.01s

这时候我们再去看一下缓存目录:

.pytest-cache
└───v└───cachenodeidsstepwise

是不是少了什么?对!因为没有失败的用例,所以不会生成lastfailed文件,那么这个时候在使用--lf--ff会发生什么呢?我们来试试:

注意:

如果我们观察的足够仔细,就会发现现在的缓存目录和之前相比不止少了lastfailed文件,还少了CACHEDIR.TAG.gitignoreREADME.md三个文件;

这是一个bug,我已经在pytest 5.3.1版本上提交了issue,预计会在之后的版本修复,如果你有兴趣深入了解一下它的成因和修复方案,可以参考这个:https://github.com/pytest-dev/pytest/issues/6290

luyao@NJ-LUYAO-T460 /d/Personal Files/Projects/pytest-chinese-doc (5.1.3) 
λ pytest -q -s --lf src/chapter-12/test_pass.py
.
1 passed in 0.01sluyao@NJ-LUYAO-T460 /d/Personal Files/Projects/pytest-chinese-doc (5.1.3) 
λ pytest -q -s --ff src/chapter-12/test_pass.py
.
1 passed in 0.02s

可以看到,它们没有实施任何影响;为什么会这样?我们去源码里找一下答案吧;

# _pytest/cacheprovider.pyclass LFPlugin:""" Plugin which implements the --lf (run last-failing) option """def __init__(self, config):...self.lastfailed = config.cache.get("cache/lastfailed", {})...def pytest_collection_modifyitems(self, session, config, items):...if self.lastfailed:...else:self._report_status = "no previously failed tests, "if self.config.getoption("last_failed_no_failures") == "none":self._report_status += "deselecting all items."config.hook.pytest_deselected(items=items)items[:] = []else:self._report_status += "not deselecting items."

可以看到,当self.lastfailed判断失败时,如果我们指定了last_failed_no_failures选项为nonepytest会忽略所有的用例(items[:] = []),否则不做任何修改(和没加--lf--ff一样),而判断self.lastfailed的依据是就是lastfailed文件;

继续看看,我们会学习到一个新的命令行选项:

# _pytest/cacheprovider.pygroup.addoption("--lfnf","--last-failed-no-failures",action="store",dest="last_failed_no_failures",choices=("all", "none"),default="all",help="which tests to run with no previously (known) failures.",)

来试试吧:

λ pytest -q -s --ff --lfnf none src/chapter-12/test_pass.py1 deselected in 0.01sλ pytest -q -s --ff --lfnf all src/chapter-12/test_pass.py
.
1 passed in 0.01s

注意:

--lfnf的实参只支持choices=("all", "none")

2. config.cache对象

我们可以通过pytestconfig对象去访问和设置缓存中的数据;下面是一个简单的例子:

# content of test_caching.pyimport pytest
import timedef expensive_computation():print("running expensive computation...")@pytest.fixture
def mydata(request):val = request.config.cache.get("example/value", None)if val is None:expensive_computation()val = 42request.config.cache.set("example/value", val)return valdef test_function(mydata):assert mydata == 23

我们先执行一次这个测试用例:

λ pytest -q src/chapter-12/test_caching.py 
F                                                                   [100%]
================================ FAILURES =================================
______________________________ test_function ______________________________mydata = 42def test_function(mydata):
>       assert mydata == 23
E       assert 42 == 23src/chapter-12/test_caching.py:43: AssertionError
-------------------------- Captured stdout setup --------------------------
running expensive computation...
1 failed in 0.05s

这个时候,缓存中没有example/value,将val的值写入缓存,终端打印running expensive computation...

查看缓存,其中新加了一个文件:.pytest-cache/v/example/value

.pytest-cache/
├── .gitignore
├── CACHEDIR.TAG
├── README.md
└── v├── cache│   ├── lastfailed│   ├── nodeids│   └── stepwise└── example└── value3 directories, 7 files

通过--cache-show选项查看,发现其内容正是42

λ pytest src/chapter-12/ -q --cache-show 'example/value'
cachedir: /Users/yaomeng/Private/Projects/pytest-chinese-doc/src/chapter-12/.pytest-cache
-------------------- cache values for 'example/value' ---------------------
example/value contains:42no tests ran in 0.00s

再次执行这个用例,这个时候缓存中已经有我们需要的数据了,终端就不会再打印running expensive computation...

λ pytest -q src/chapter-12/test_caching.py 
F                                                                   [100%]
================================ FAILURES =================================
______________________________ test_function ______________________________mydata = 42def test_function(mydata):
>       assert mydata == 23
E       assert 42 == 23src/chapter-12/test_caching.py:43: AssertionError
1 failed in 0.04s

3. Stepwise

试想一下,现在有这么一个场景:我们想要在遇到第一个失败的用例时退出执行,并且下次还是从这个用例开始执行;

以下面这个测试模块为例:

# src/chapter-12/test_sample.pydef test_one():assert 1def test_two():assert 0def test_three():assert 1def test_four():assert 0def test_five():assert 1

我们先执行一下测试:pytest --cache-clear --sw src/chapter-12/test_sample.py

λ pytest --cache-clear --sw -q src/chapter-12/test_sample.py
.F
================================= FAILURES =================================
_________________________________ test_two _________________________________def test_two():
>       assert 0
E       assert 0src/chapter-12/test_sample.py:28: AssertionError
!!!!!! Interrupted: Test failed, continuing from this test next run. !!!!!!!
1 failed, 1 passed in 0.13s

使用--cache-clear清除之前的缓存,使用--sw, --stepwise使其在第一个失败的用例处退出执行;

现在我们的缓存文件中lastfailed记录了这次执行失败的用例,即为test_two()nodeids记录了所有的测试用例;特殊的是,stepwise记录了最近一次失败的测试用例,这里也是test_two()

接下来,我们用--sw的方式再次执行:pytest首先会读取stepwise中的值,并将其作为第一个用例开始执行;

λ pytest --sw -q src/chapter-12/test_sample.py
F
================================= FAILURES =================================
_________________________________ test_two _________________________________def test_two():
>       assert 0
E       assert 0src/chapter-12/test_sample.py:28: AssertionError
!!!!!! Interrupted: Test failed, continuing from this test next run. !!!!!!!
1 failed, 1 deselected in 0.12s

可以看到,test_two()作为第一个用例开始执行,在第一个失败处退出;

其实,pytest还提供了一个--stepwise-skip的命令行选项,它会忽略第一个失败的用例,在第二个失败处退出执行;我们来试一下:

λ pytest --sw --stepwise-skip -q src/chapter-12/test_sample.py
F.F
=============================== FAILURES ================================ 
_______________________________ test_two ________________________________def test_two():
>       assert 0
E       assert 0src\chapter-12\test_sample.py:28: AssertionError
_______________________________ test_four _______________________________def test_four():
>       assert 0
E       assert 0src\chapter-12\test_sample.py:36: AssertionError
!!!!! Interrupted: Test failed, continuing from this test next run. !!!!! 2 failed, 1 passed, 1 deselected in 0.16s

这个时候,在第二个失败的用例test_four()处退出执行,同时stepwise文件的值也改成了"test_sample.py::test_four"

其实,本章所有的内容都可以在源码的_pytest/cacheprovider.py文件中体现,如果能结合源码学习,会有事半功倍的效果;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/792832.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Spring Boot 整合 RabbitMQ 实现延迟消息

关于 RabbitMQ 消息队列&#xff08;Message Queuing&#xff0c;简写为 MQ&#xff09;最初是为了解决金融行业的特定业务需求而产生的。慢慢的&#xff0c;MQ 被应用到了更多的领域&#xff0c;然而商业 MQ 高昂的价格让很多初创公司望而却步&#xff0c;于是 AMQP&#xff0…

网络基础二——传输层协议UDP与TCP

九、传输层协议 ​ 传输层协议有UDP协议、TCP协议等&#xff1b; ​ 两个远端机器通过使用"源IP"&#xff0c;“源端口号”&#xff0c;“目的IP”&#xff0c;“目的端口号”&#xff0c;"协议号"来标识一次通信&#xff1b; 9.1端口号的划分 ​ 0-10…

uniapp将图片地址base64格式相互转换

1、下载image-tools插件并安装 npm i image-tools --save-dev 2、引入image-tools import { pathToBase64, base64ToPath } from image-tools 3、将图片转换成base64格式 create() {// 图片转化为base64格式pathToBase64(/static/logo.png).then(res> {console.log(res…

2024年腾讯云4核8G服务器性能可以满足哪些使用场景?

腾讯云4核8G服务器多少钱&#xff1f;腾讯云4核8G轻量应用服务器12M带宽租用价格646元15个月&#xff0c;活动页面 txybk.com/go/txy 活动链接打开如下图所示&#xff1a; 腾讯云4核8G服务器优惠价格 这台4核8G服务器是轻量应用服务器&#xff0c;详细配置为&#xff1a;轻量4核…

【Redis】分布式锁及其他常见问题

分布式锁及其他常见问题 1. 我看你的项目都用到了 Redis&#xff0c;你在最近的项目的哪些场景下用到了 Redis 呢&#xff1f; 一定要结合业务场景来回答问题&#xff01;要是没有不要硬讲&#xff0c;除非面试官问&#xff1b; 接下来面试官将深入发问。 你没用到的也可能会…

【opencv】教程代码 —video(2) optical_flow (稀疏光流、稠密光流)

1. optical_flow.cpp 稀疏光流 #include <iostream> // 引入输入输出流库 #include <opencv2/core.hpp> // 引入OpenCV的核心功能模块 #include <opencv2/highgui.hpp> // 引入OpenCV的高级GUI模块&#xff0c;提供显示图像的功能 #include <opencv2/imgp…

Python | NCL风格 | EOF | 相关 | 回归

这里在linux系统上使用geocat实现NCL风格的图片绘制 geocat Linux上安装 geocat conda update condaconda create -n geocat -c conda-forge geocat-vizconda activate geocatconda update geocat-viz Dataset - NOAA Optimum Interpolation (OI) SST V2 # 海温月平均数据- lsm…

C++核心高级编程 --- 4.类和对象

文章目录 第四章&#xff1a;4.类和对象4.1 封装4.1.1 封装的意义4.1.2 struct与class的区别 4.2 对象的初始化和清理4.2.1 构造函数和析构函数4.2.2 构造函数的分类及调用4.2.3 拷贝构造函数调用时机4.2.4 构造函数调用规则4.2.5 深拷贝与浅拷贝4.2.6 初始化列表4.2.7 类对象作…

Qt | Qt 快速入门(零基础)

01 Qt 简介 1、Qt 是一个跨平台的 C++图形用户界面库,说简单点,Qt 的本质就是一个 C++类库,使用Qt 就是怎样使用 Qt 类库中的类及其类中的成员函数的问题。在 QT5 中 QML(这是一种声明性语言)和 Qt Quick 成为 Qt 的核心之一,但 C++仍是 QT 的核心。 2、Qt 是跨平台的,也…

数据结构——顺序表实现通讯录

目录 前言 一、基于动态顺序表实现通讯录 二、代码具体实现 2.1 初始化通讯录 2.2 添加通讯录数据 2.3 展示通讯录 2.4 按名字来查找通讯录信息 2.5 删除通讯录的数据 2.6 查找通讯录的数据 2.7 修改通讯录的数据 2.8 销毁通讯录 上传通讯录数据 写入通讯录数据 三、完整代码 总…

基础之重蹈覆辙

MESI缓存一致性协议 前&#x1f33d;&#xff1a; 高速缓存底层数据结构&#xff1a;拉链散列表的结构 bucket - cache entry - tag主内存地址 cache line缓存数据 flag缓存行状态 cache line64字节 有效引用主内存地址&#xff0c;连续的相邻的数据结构 读取特别快 处理器…

关于Tomcat双击startup.bat 闪退的解决⽅法

详解Tomcat双击startup.bat 闪退的解决⽅法 作为⼀个刚学习Tomcat的程序猿来说&#xff0c;这是会经常出现的错误。 1.环境变量问题 1.1 ⾸先需要确认java环境是否配置正确&#xff0c;jdk是否安装正确 winR打开cmd&#xff0c;输⼊java 或者 javac 出现下图所⽰就说明jdk配置正…

AI与技术美术(TechArt)

AI技术与TA 人工智能&#xff08;AI&#xff09;技术在技术美术&#xff08;TechArt&#xff09;领域的应用&#xff0c;为创业者开辟了一片新的天地。技术美术作为一个跨学科领域&#xff0c;融合了传统美术和现代技术&#xff0c;特别是AI技术&#xff0c;以创造新型的艺术表…

spark-hive连接操作流程、踩坑及解决方法

文章目录 1 简介2 版本匹配3 spark hive支持版本源码编译3.1 spark-src下载3.2 maven换源3.3 spark编译 4 hive 安装与mysql-metastore配置4.1 mysql下载安装4.1.1 为mysql设置系统环境变量4.1.2 初次登陆更改root身份密码4.1.3 安装后直接更改密码 4.2 hive初始化4.2.1 编写hi…

【leetcode面试经典150题】10.跳跃游戏 II(C++)

【leetcode面试经典150题】专栏系列将为准备暑期实习生以及秋招的同学们提高在面试时的经典面试算法题的思路和想法。本专栏将以一题多解和精简算法思路为主&#xff0c;题解使用C语言。&#xff08;若有使用其他语言的同学也可了解题解思路&#xff0c;本质上语法内容一致&…

pycharm pyspark连接虚拟机的hive表 读取数据

方法&#xff1a; hive配置hiveserver2和metastore url <!-- 指定hiveserver2连接的host --> <property><name>hive.server2.thrift.bind.host</name><value>hadoop111</value> </property><!-- 指定hiveserver2连接的端口号 -…

langchain + azure chatgpt组合配置并运行

首先默认你已经有了azure的账号。 最重要的是选择gpt-35-turbo-instruct模型、api_version&#xff1a;2023-05-15&#xff0c;就这两个参数谷歌我尝试了很久才成功。 我们打开https://portal.azure.com/#home&#xff0c;点击更多服务&#xff1a; 我们点击Azure OpenAI&#…

华为ensp中ospf多区域管理 原理及配置命令(详解)

作者主页&#xff1a;点击&#xff01; ENSP专栏&#xff1a;点击&#xff01; ————前言———— OSPF 多区域的主要作用是缩小链路状态数据库和路由表的规模&#xff0c;减少路由更新的频率&#xff0c;提高网络的可扩展性&#xff0c;实现路由过滤和路由汇总&#xff0…

0.k8s简介

目录 k8s是什么 k8s不是什么 云原生 微服务 整体式架构与微服务架构 微服务的特性 微服务的优势 k8s是什么 Kubernetes 是一个可移植、可扩展的开源平台&#xff0c;用于管理容器化的工作负载和服务&#xff0c;可促进声明式配置和自动化。 Kubernetes 拥有一个庞大且快…

A First Course in the Finite Element Method【Daryl L.】|PDF电子书

专栏导读 作者简介&#xff1a;工学博士&#xff0c;高级工程师&#xff0c;专注于工业软件算法研究本文已收录于专栏&#xff1a;《有限元编程从入门到精通》本专栏旨在提供 1.以案例的形式讲解各类有限元问题的程序实现&#xff0c;并提供所有案例完整源码&#xff1b;2.单元…