我在跑步aws ecs execute-command --cluster UltimaF --task 838d773b17954bcfbbacf343fb4fea70 --container ultima --interactive --command "/bin/sh"
取回:An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: The execute command failed because execute command was not enabled when the task was run or the execute command agent isn\xe2\x80\x99t running. Wait and try again or run a new task with execute command enabled and try again.
我已保证:
\naws ecs describe-tasks --cluster UltimaF --tasks 838d773b17954bcfbbacf343fb4fea70回报"enableExecuteCommand": true似乎是一个常见错误。我遵循了 Stackoverflow 上所有可能的建议(添加链接、网络等),但这对我来说没有什么区别。我在 Windows 上运行。
我的 Dockerfile:
#Pull base image.
FROM python:3.9.5-slim
#Usefull to get logs
ENV PYTHONUNBUFFERED 1
#Make local dir
RUN mkdir -p /app
#set as the working directory
WORKDIR /app
#https://luis-sena.medium.com/creating-the-perfect-python-dockerfile-51bdec41f1c8
COPY requirements.txt .
#now copy all the files in this directory to \code
ADD . .
#https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/
RUN apt-get update && \
apt-get install -y postgresql-server-dev-all gcc python3-dev musl-dev && \
pip install -r requirements.txt && \
adduser --disabled-password --no-create-home app
USER app
#CMD python manage.py …Run Code Online (Sandbox Code Playgroud) 我有一个返回列表类型列的函数。因此,我的专栏之一是一个列表。我想将此列表列变成多列。例如:
\nuse polars::prelude::*;\nuse polars::df;\n\nfn main() {\n let s0 = Series::new("a", &[1i64, 2, 3]);\n let s1 = Series::new("b", &[1i64, 1, 1]);\n let s2 = Series::new("c", &[Some(2i64), None, None]);\n // construct a new ListChunked for a slice of Series.\n let list = Series::new("foo", &[s0, s1, s2]);\n\n // construct a few more Series.\n let s0 = Series::new("Group", ["A", "B", "A"]);\n let s1 = Series::new("Cost", [1, 1, 1]);\n let df = DataFrame::new(vec![s0, s1, list]).unwrap();\n\n dbg!(df);\nRun Code Online (Sandbox Code Playgroud)\n在这个阶段 DF 看起来像这样:
\n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 Group \xe2\x94\x86 …Run Code Online (Sandbox Code Playgroud) 我有一个特质DataSet,我是Serialize这样实现的:
impl Serialize for dyn DataSet {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut seq = serializer.serialize_map(Some(2))?;
seq.serialize_entry("fields", "Hello")?;
seq.serialize_entry("measures", "There")?;
seq.end()
}
}
Run Code Online (Sandbox Code Playgroud)
现在,在程序/应用程序中,我共享指向特征对象的指针:
let x: Arc<Mutex<dyn DataSet>> = Arc::new(Mutex::new(data));
Run Code Online (Sandbox Code Playgroud)
哪里data有实现 DataSet 的对象。
现在,我想把这个对象转换成json(即序列化它):
serde_json::to_string(&x)
Run Code Online (Sandbox Code Playgroud)
它适用于Box而不是Arc<Mutex<>>. 但Arc<Mutex<>>编译器抱怨:
the size for values of type `dyn base_engine::DataSet` cannot be known at compilation time
the trait `Sized` is not implemented for `dyn base_engine::DataSet`
the …Run Code Online (Sandbox Code Playgroud) Jon Gjengset在Rust for Rustaceans中指出(强调我的):
\n\n\n当您\xe2\x80\x99 在静态和动态调度之间进行选择时,\n很少有明确的正确答案。不过,从广义上讲,您\xe2\x80\x99ll\n希望在库中使用静态调度,在二进制文件中使用动态调度。在库中,您希望允许用户决定哪种类型的调度最适合他们,因为您不知道他们的需求是什么。如果您使用动态调度,它们\xe2\x80\x99将被迫执行相同的操作,而如果您使用\n静态调度,它们可以选择是否使用动态调度。”
\n
我对此的解释是:
\n在库中应该使用:fn execute(x: Arc<impl MyTrait>) -> ...这是静态调度。
在二进制文件中:let x: Arc<dyn MyTrait> = Arc::new(my_obj)这是动态的。
然后我想调用execute(x),但编译器抱怨:
error[E0277]: the size for values of type `dyn MyTrait` cannot be known at compilation time\n --> src/main.rs:12:13\n |\n12 | execute(x);\n | ------- ^ doesn\'t have a size known at compile-time\n | |\n | required by a bound introduced …Run Code Online (Sandbox Code Playgroud) rust ×3
amazon-ecs ×1
aws-cli ×1
dataframe ×1
dispatch ×1
django ×1
docker ×1
execute ×1
explode ×1
postgresql ×1
python ×1
rust-polars ×1
serde ×1
traits ×1
types ×1