我正在尝试创建一个VSCode扩展.这个扩展提供了两个命令,不用介意它们的实现:
export function activate(context: ExtensionContext) {
const provider = new ContentProvider();
const providerRegistrations = Disposable.from(
workspace.registerTextDocumentContentProvider(ContentProvider.scheme, provider)
);
// Open the dynamic document, and shows it in the next editor
const openMyExtensionCommandRegistration = commands.registerTextEditorCommand('extension.openMyExtension', editor => {
// Activate the extension and do something
});
const useMyExtensionCommandRegistration = commands.registerTextEditorCommand('extension.useMyExtension', editor => {
// Do something
});
context.subscriptions.push(
provider,
openMyExtensionCommandRegistration,
useMyExtensionCommandRegistration,
providerRegistrations
);
}
Run Code Online (Sandbox Code Playgroud)
这是我package.json文件的一部分:
"activationEvents": [
"onCommand:extension.openMyExtension"
],
"main": "./out/extension",
"contributes": {
"commands": [
{
"command": "extension.openMyExtension",
"title": …Run Code Online (Sandbox Code Playgroud) 我想用 Locust 进行一些负载测试,以了解我的系统如何响应并行请求。
假设我的系统同时收到 10 个请求。我的第一个反应是测量这 10 个请求中每一个的响应时间。我做了一个简单locustfile.py的衡量:
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
pass
def on_stop(self):
pass
@task(1)
def content_query(self):
self.client.get('/content')
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 1000
max_wait = 1000
Run Code Online (Sandbox Code Playgroud)
我使用了这个文件并生成了 10 只蝗虫。我能够得到我想要的测量结果。
但后来我意识到我想知道的是我的系统对所有这 10 个请求的回复速度有多快。如果每个请求需要 20 毫秒才能得到回复,我不知道:
为了衡量这一点,我有以下想法:我希望我的系统在 1 小时内始终处于 10 个请求的负载上,并测量在此期间处理了多少请求。
换句话说,只要 10 个请求中的一个成功,就应该执行另一个请求来代替它。
我怎么能用 Locust 做到这一点?
我有使用请求成功处理程序的想法,如 Locust 文档中所述:
from locust import HttpLocust, TaskSet, task, events
def my_success_handler(request_type, name, response_time, response_lenght, **kw): …Run Code Online (Sandbox Code Playgroud) 我正在尝试调试 GitLab CI 管道中的一些问题。我有一个步骤 B,它使用了步骤 A 中的一些工件。
步骤 A 很长(并且在 CI 中工作),所以我不想在本地运行它:我只是从 GitLab 下载生成的工件。所以我有一个artifacts.zip,我提取它以获得一个output和一个logs目录。到现在为止还挺好。
我想在本地运行步骤 B,使用gitlab-runner. 请注意,我使用的是 9.5 版(https://docs.gitlab.com/runner/install/old.html)。
我正在使用这个命令:
gitlab-runner exec docker step-b
Run Code Online (Sandbox Code Playgroud)
正如我所解释的,step-b需要来自step-a. 这是我尝试过的:
gitlab-runner exec docker --docker-volumes ~/Downloads/output step-b
Run Code Online (Sandbox Code Playgroud)
在步骤 B 中执行的脚本之一正在执行类似mv ../output /some/where/else. 但是,此脚本失败并出现以下错误:
mv: cannot stat '../output': No such file or directory
Run Code Online (Sandbox Code Playgroud)
出现此错误后,我有两个问题:
这个脚本在哪里执行?它是这样调用的.gitlab-ci.yml:
./scripts/my_script.sh.
Run Code Online (Sandbox Code Playgroud)
什么是.在这种情况下?
--docker-volumes ~/Downloads/output将目录安装在正确的位置以便我的脚本可以找到它?编辑
根据要求,这里是步骤 A 的描述。
script: …Run Code Online (Sandbox Code Playgroud)