我在aws上启动并运行了一个redshift集群,并通过配置VPC安全组来授权入站查询
然后我尝试使用pgAdmin连接到redshift并收到以下错误
An error has occurred:
ERROR: permission denied to set parameter "client_min_messages" to "notice"
Run Code Online (Sandbox Code Playgroud)
和
An error has occurred:
Column not found in pgSet: "datlastsysoid"
Run Code Online (Sandbox Code Playgroud) 我有一个项目目录如下所示
Projects/
....this_project/
........this_project/
............__init__.py
............code.py
............tests/
................conftest.py
................test_1.py
................test_2.py
Run Code Online (Sandbox Code Playgroud)
我通过将以下代码放入conftest.py添加了命令行选项(--PALLADIUM_CONFIG)
def pytest_addoption(parser):
parser.addoption("--PALLADIUM_CONFIG", action="store")
@pytest.fixture
def PALLADIUM_CONFIG(request):
return request.config.getoption("--PALLADIUM_CONFIG")
Run Code Online (Sandbox Code Playgroud)
而奇怪的是:
如果我进入
Projects/this_project/this_project
Run Code Online (Sandbox Code Playgroud)
要么
Projects/this_project/this_project/tests
Run Code Online (Sandbox Code Playgroud)
并运行
py.test --PALLADIUM_CONFIG=***
Run Code Online (Sandbox Code Playgroud)
如果运行良好
但是如果我找到自己的话
Projects/this_project
Run Code Online (Sandbox Code Playgroud)
要么
Projects
Run Code Online (Sandbox Code Playgroud)
然后pytest给我错误
py.test: error: unrecognized arguments: --PALLADIUM_CONFIG=***
Run Code Online (Sandbox Code Playgroud) 我有一个docker容器正在运行
sudo docker ps -a
Run Code Online (Sandbox Code Playgroud)
结果:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0cd8d5166717 32bit/ubuntu:14.04 /bin/bash 15 hours ago Up About an hour hadoop-test
Run Code Online (Sandbox Code Playgroud)
如何将此运行容器再次带到-it模式并获取ubuntu系统的终端?
我尝试使用以下命令启动容器
sudo docker run ubuntu
Run Code Online (Sandbox Code Playgroud)
之后我查了一下
sudo docker ps -a
Run Code Online (Sandbox Code Playgroud)
发现容器已经退出
为什么退出?
我怎么能保持它在backgroud中运行而不指定-it并在要求时附加到它?
例如,结果如下:
df.filter("project = 'en'").select("title","count").groupBy("title").sum()
Run Code Online (Sandbox Code Playgroud)
会返回一个数组.
如何将火花DataFrame保存为磁盘上的csv文件?
我在aws lambda中使用boto3来查找位于法兰克福地区的S3中的fecth对象.
v4是必要的.否则将返回错误
"errorMessage": "An error occurred (InvalidRequest) when calling
the GetObject operation: The authorization mechanism you have
provided is not supported. Please use AWS4-HMAC-SHA256."
Run Code Online (Sandbox Code Playgroud)
实现了配置signature_version的方法http://boto3.readthedocs.org/en/latest/guide/configuration.html
但由于我使用的是AWS lambda,因此我无法访问底层配置文件
我的AWS lambda函数的代码
from __future__ import print_function
import boto3
def lambda_handler (event, context):
input_file_bucket = event["Records"][0]["s3"]["bucket"]["name"]
input_file_key = event["Records"][0]["s3"]["object"]["key"]
input_file_name = input_file_bucket+"/"+input_file_key
s3=boto3.resource("s3")
obj = s3.Object(bucket_name=input_file_bucket, key=input_file_key)
response = obj.get()
return event #echo first key valuesdf
Run Code Online (Sandbox Code Playgroud)
可以在此代码中配置signature_version吗?以Session为例.或者有什么解决方法吗?
我使用构建的数据处理管道
S3 + SNS + Lambda
因为S3无法从其存储区域发送通知,所以我利用SNS向其他地区的Lambda发送S3通知.
用函数编码的lambda函数
from __future__ import print_function
import boto3
def lambda_handler (event, context):
input_file_bucket = event["Records"][0]["s3"]["bucket"]["name"]
input_file_key = event["Records"][0]["s3"]["object"]["key"]
input_file_name = input_file_bucket+"/"+input_file_key
s3=boto3.resource("s3")
obj = s3.Object(bucket_name=input_file_bucket, key=input_file_key)
response = obj.get()
return event #echo first key valuesdf
Run Code Online (Sandbox Code Playgroud)
当我运行保存和测试时,我收到以下错误
{
"stackTrace": [
[
"/var/task/lambda_function.py",
20,
"lambda_handler",
"response = obj.get()"
],
[
"/var/runtime/boto3/resources/factory.py",
394,
"do_action",
"response = action(self, *args, **kwargs)"
],
[
"/var/runtime/boto3/resources/action.py",
77,
"__call__",
"response = getattr(parent.meta.client, operation_name)(**params)"
],
[
"/var/runtime/botocore/client.py",
310,
"_api_call",
"return self._make_api_call(operation_name, kwargs)"
], …Run Code Online (Sandbox Code Playgroud) 我在dockerhub上创建了一个自动构建存储库(通过github)并尝试将自动构建的映像拉到云服务器上.
使用类似的东西
docker pull com.company/project:tag
但它给了我
Error: image com.company/project:tag not found
Run Code Online (Sandbox Code Playgroud)
它通常适用于公共存储库,我是否必须为私有存储库执行其他操作?
有一个由DatatimeIndex索引的时间序列(ts),想要将其分组10分钟
index x y z
ts1 ....
ts2 ....
...
Run Code Online (Sandbox Code Playgroud)
我知道怎么分组1分钟
def group_by_minute(timestamp):
year = timestamp.year
month = timestamp.month
day = timestamp.day
hour = timestamp.hour
minute = timestamp.minute
return datetime.datetime(year, month, day, hour, minute)
Run Code Online (Sandbox Code Playgroud)
然后
ts.groupby(group_by_minute, axis=0)
Run Code Online (Sandbox Code Playgroud)
我的定制功能(大致)
def my_function(group):
first_latitude = group['latitude'].sort_index().head(1).values[0]
last_longitude = group['longitude'].sort_index().tail(1).values[0]
return first_latitude - last_longitude
Run Code Online (Sandbox Code Playgroud)
所以ts DataFrame绝对应该包含'纬度'和'经度'列
使用TimeGrouper时
ts.groupby(pd.TimeGrouper(freq='100min')).apply(my_function)
Run Code Online (Sandbox Code Playgroud)
我有以下错误,
TypeError: cannot concatenate a non-NDFrame object
Run Code Online (Sandbox Code Playgroud) 我知道有几家小公司没有对ETL流程进行测试,但从软件工程的角度看,这似乎不是最理想的.
人们通常如何对ETL过程进行测试/单元测试/功能测试?
非常感谢
docker ×3
amazon-s3 ×2
aws-lambda ×2
boto3 ×2
python ×2
amazon-iam ×1
apache-spark ×1
dockerhub ×1
etl ×1
pandas ×1
pgadmin ×1
pytest ×1
scala ×1
testing ×1