小编Ika*_*ský的帖子

如何仅允许混凝土用户使用气流

问题很简单.我需要限制气流Web用户只查看和执行某些DAG和任务.

如果可能的话,我宁愿不使用Kerberos也不使用OAuth.

多租户的选择似乎是一个选项去,但不能使它工作,我所期望的方式.我目前的设置:

  • 添加了气流网络用户testikar通过Web身份验证/密码
  • 我的unix用户名是ikar带回家的/home/ikar
  • 没有testunix用户
  • 气流1.8.2安装在/home/ikar/airflow
  • 添加了两个DAG,其中包含一项任务:
    • 一个owner设置为ikar
    • 一个owner设置为test
  • cat airflow.cfg:
[core]
# The home folder for airflow, default is ~/airflow
airflow_home = /home/ikar/airflow

# The folder where your airflow pipelines live, most likely a
# subfolder in a code repository
# This path must be absolute
dags_folder = /home/ikar/airflow-test/dags

# The folder …
Run Code Online (Sandbox Code Playgroud)

airflow

7
推荐指数
1
解决办法
1774
查看次数

尝试在 HD 上写入文件时出现“(只读文件系统)”

我想使用在 Tomcat9 上运行的 springboot servlet 在此路径中编写一个文件

/mnt/data-new/data/USERPROFILE/607/file.txt 
Run Code Online (Sandbox Code Playgroud)

当我尝试写入该文件时,出现此错误:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Jul 03 14:11:39 UTC 2019
There was an unexpected error (type=Internal Server Error, status=500).
/mnt/data-new/data/USERPROFILE/607/file.txt (Read-only file system)
Run Code Online (Sandbox Code Playgroud)

我已经使用 777 在该路径上设置了权限,但没有任何改变。

Servlet 代码非常简单:

/mnt/data-new/data/USERPROFILE/607/file.txt 
Run Code Online (Sandbox Code Playgroud)

我创建了一个名为“file2.txt”的文件,我可以使用以下示例代码读取该文件:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Jul 03 14:11:39 UTC 2019
There was …
Run Code Online (Sandbox Code Playgroud)

io ubuntu file spring-boot tomcat9

6
推荐指数
1
解决办法
2842
查看次数

analysis_options.yaml 中有多个包含吗?

我想analysis_options.yaml为我的项目合并两个(或更多)文件,但无法找到如何做到这一点的方法。

这有效:

include: package:pedantic/analysis_options.yaml

...
Run Code Online (Sandbox Code Playgroud)

这也有效:

include: package:flutter/analysis_options_user.yaml # note different "base" lint rules

...
Run Code Online (Sandbox Code Playgroud)

但我需要这样的东西:

include:
  - package:pedantic/analysis_options.yaml
  - package:flutter/analysis_options_user.yaml

...
Run Code Online (Sandbox Code Playgroud)

...导致以下错误:

警告:包含文件 - package:pedantic/analysis_options.yaml - package:flutter/analysis_options_user.yaml

在 /home/.../analysis_options.yaml 中找不到。(include_file_not_found at [...] analysis_options.yaml:1)

有没有人遇到/解决过同样的问题?

dart flutter

6
推荐指数
1
解决办法
1428
查看次数

如何在 ubuntu 18.04 上安装 ansible 2.9+ 并使用 python3?

我正在尝试在 Ubuntu Bionic (18.04 LTS) 上安装最小的ansible 2.9.x。

最终目标是在每次提交时构建新的磁盘映像(使用打包程序),并希望该过程尽可能快。

使用默认的 Ubuntu ansible

仿生中的默认 ansible是 2.5.x

这太旧了,所有 ansible 脚本都是为 2.9+ 编写的。

使用官方 PPA

使用推荐的安装方式建议将以下行添加到/etc/apt/sources.list

deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
Run Code Online (Sandbox Code Playgroud)

并运行以下命令:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
$ sudo apt update
$ sudo apt install ansible
Run Code Online (Sandbox Code Playgroud)

但它仍然需要 python2 包:

$ sudo apt install ansible
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython-stdlib …
Run Code Online (Sandbox Code Playgroud)

python-3.x ansible ansible-2.x ubuntu-18.04

6
推荐指数
1
解决办法
1万
查看次数

如何从celery pprint输出中删除时间戳?

当运行celery worker时,的输出的每一行pprint总是以时间戳作为前缀,并且也将被剥离。这使得它非常不可读:

[2015-11-05 16:01:12,122: WARNING/Worker-2] {
[2015-11-05 16:01:12,122: WARNING/Worker-2] u'key1'
[2015-11-05 16:01:12,122: WARNING/Worker-2] :
[2015-11-05 16:01:12,122: WARNING/Worker-2] 'value1'
[2015-11-05 16:01:12,122: WARNING/Worker-2] ,
u'_id':
[2015-11-05 16:01:12,122: WARNING/Worker-2] ObjectId('55fff3b74322c53d18ae4687')
...
Run Code Online (Sandbox Code Playgroud)

有没有办法告诉芹菜不要格式化输出pprint

更新:

这个问题有点错。所需的输出如下所示:

[2015-11-05 16:01:12,122: WARNING/Worker-2] 
{
    u'key1': 'value1',
    u'_id': ObjectId('55fff3b74322c53d18ae4687'),
    ...
Run Code Online (Sandbox Code Playgroud)

python celery pprint

5
推荐指数
1
解决办法
157
查看次数

user:使用selenium传递代理

在程序中使用用户身份验证代理的最佳/最简单方法是什么?我目前有这个,但我需要在浏览器打开时填写用户名和密码.

from selenium import webdriver
PROXY = "123.123.123.243:80"

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--proxy-server=http://{}".format(PROXY))

print(chrome_options.arguments)
chrome = webdriver.Chrome(executable_path="drivers/chromedriver",chrome_options=chrome_options)
chrome.get("https://www.ipinfo.io")
Run Code Online (Sandbox Code Playgroud)

python selenium webdriver selenium-webdriver selenium3

5
推荐指数
1
解决办法
2409
查看次数

如何定义不应定期运行的Airflow DAG /任务

目标非常简单:我需要为不应定期运行的手动任务创建DAG,但仅在管理员按下"运行"按钮时才需要.理想情况下,无需切换"取消暂停"和"暂停"DAG(您知道有人肯定会忘记暂停).

到目前为止我只是来过schedule_interval="0 0 30 2 *"(2月30日希望永远不会发生),但必须有更好的方法!

在那儿?

airflow apache-airflow airflow-scheduler

5
推荐指数
2
解决办法
1453
查看次数

Spring boot - 预检响应没有 HTTP 正常状态

我正在使用 Angular 5 制作网络,每次尝试发出请求时都会收到此错误GET。我在这里阅读了大量的答案,但没有一个对我有用。

正如我所读到的,这是因为我正在向此请求添加自定义标头,这是需要完成的,因为我正在使用 Spring Security,我认为这是导致问题的原因。这是我当前的 Spring Security 配置,我通过阅读问题进行了配置,但仍然无法正常工作,我不知道我是否做错了什么:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.Arrays;

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .cors()
                .and()
                .authorizeRequests().anyRequest().permitAll()
                .and()
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .csrf().disable();
    }

    @Override
    public void configure(WebSecurity web ) throws Exception
    {
        web.ignoring().antMatchers( HttpMethod.OPTIONS, "/**" );
    }

    @Bean
    CorsConfigurationSource corsConfigurationSource() {
        CorsConfiguration …
Run Code Online (Sandbox Code Playgroud)

spring-security cors preflight spring-boot angular

5
推荐指数
1
解决办法
7526
查看次数

Flutter(Dart)如何在点击应用程序时将副本添加到剪贴板?

我是Flutter的初学者,我刚刚开始关注他们的Name Generator应用程序教程,并构建了一个简单的名称生成应用程序。我想知道当用户点击名称时是否可以将副本添加到剪贴板功能?我试图实现一个在堆栈上找到的解决方案,但没有成功。我的完整代码在这里。任何建议表示赞赏。

import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Startup Name Generator',
      home: new RandomWords(),
    );
  }
}

class RandomWords extends StatefulWidget {
  @override
  RandomWordsState createState() => new RandomWordsState();
}

class RandomWordsState extends State<RandomWords> {
  final List<WordPair> _suggestions = <WordPair>[];
  final Set<WordPair> _saved = new Set<WordPair>();
  final TextStyle _biggerFont = const TextStyle(fontSize: 18.0);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar( …
Run Code Online (Sandbox Code Playgroud)

dart flutter

5
推荐指数
4
解决办法
1258
查看次数

是否可以将自定义路线用于芹菜的画布基元?

我有不同的Rabbit队列,每个队列专门用于一种特殊的订单处理:

# tasks.py

@celery.task
def process_order_for_product_x(order_id):
    pass  # elided ...


@celery.task
def process_order_for_product_y(order_id):
    pass  # elided ...


# settings.py

CELERY_QUEUES = {
    "black_hole": {
        "binding_key": "black_hole",
        "queue_arguments": {"x-ha-policy": "all"}
    },
    "product_x": {
        "binding_key": "product_x",
        "queue_arguments": {"x-ha-policy": "all"}
    },
    "product_y": {
        "binding_key": "product_y",
        "queue_arguments": {"x-ha-policy": "all"}
    },
Run Code Online (Sandbox Code Playgroud)

我们的政策是通过设置来强制执行显式路由CELERY_DEFAULT_QUEUE = 'black_hole',然后再从中使用black_hole

这些任务中的每一个都可以使用芹菜的画布基元,如下所示:

# tasks.py

@celery.task
def process_order_for_product_x(order_id):
    # These can run in parallel
    stage_1_group = group(do_something.si(order_id),
                          do_something_else.si(order_id))

    # These can run in parallel
    another_group = group(do_something_at_end.si(order_id),
                          do_something_else_at_end.si(order_id))

    # …
Run Code Online (Sandbox Code Playgroud)

celery django-celery

3
推荐指数
1
解决办法
989
查看次数