我有以下Python代码和输出:
>>> import numpy as np
>>> s = [12.40265325, -1.3362417499999921, 6.8768662500000062, 25.673127166666703, 19.733372250000002, 21.649556250000003, 7.1676752500000021, -0.85349583333329804, 23.130314250000012, 20.074925250000007, -0.29701574999999281, 17.078694250000012, 3.3652611666666985, 19.491246250000003, -0.76856974999999039, -1.8838917499999965, -6.8547018333333085, 4.5195052500000088, 5.9882702500000136, -9.5889237499999922, 13.98170916666669, -2.3662137499999929, 12.111165250000013, -6.8334957499999902, -21.379336749999993, 8.4651301666666967, 2.5094612500000082, -0.21386274999998989, 5.1226162500000072, 14.283680166666699, -4.3340977499999909, -2.7831607499999933, 8.2339832500000085, -12.841856749999991, -6.4984398333333075, -6.2773697499999912, -13.638411749999996, -15.90088974999999, -8.2505068333333043, -19.616496749999996, -4.4346607499999919, -10.056376749999991, -13.581729833333299, -8.2284047499999957, -4.5957137499999945, -5.3758427499999968, -12.254779833333302, 11.207287250000007, -12.848971749999997, -14.449801749999992, -17.247984749999993, -17.475253833333305]
>>> np.mean(s)
1.3664283380001927e-14
>>> np.std(s)
12.137473069268983
>>> (s - np.mean(s)) / np.std(s)
array([ 1.02184806, -0.11009225, 0.56658138, 2.1151954 , ... …Run Code Online (Sandbox Code Playgroud) 我正在尝试从python连接到本地运行的Restlet服务器,但连接无限挂起(或者如果我设置超时则超时).
import urllib2
handle = urllib2.urlopen("http://localhost:8182/contact/123") # hangs
Run Code Online (Sandbox Code Playgroud)
如果我使用curlshell打开上面的URL,结果会很快返回.如果我使用urllib2打开一个不同的本地服务(例如,端口8000上的Django Web服务器),urllib2工作正常.
我试过禁用防火墙(我在OS X上这样做).我已经尝试将localhost更改为127.0.0.1.除了用户代理之外,来自Restlet的curl和urllib2连接的日志显示相同.
我的解决方法是只调用curlvia subprocess,但我宁愿理解为什么会失败.
这是我的Restlet资源的外观:
public class ContactResource extends ServerResource {
@Get
public String represent() throws Exception {
return "<contact details>";
}
//....
}
Run Code Online (Sandbox Code Playgroud)
如果您需要更多信息/代码,请告诉我们
我创建了一个新的分支A来从master做一些工作并做了一些工作并做了本地提交.
然后我创建了一个分支B来从master做一些工作并做了一些工作并提交了它.然后我把它合并到主人并且确实推到了上游主人.
现在我切换回分支A.所以为了获得最新的变化合并我应该在egit使用哪个选项?从上游取或拉?
有什么区别?
我不想随意选择,因为我不想覆盖这些变化......
例如:
MY_MESSAGE = 'Dear %s, hello.'
# ...
name = "jj"
print MY_MESSAGE % name
Run Code Online (Sandbox Code Playgroud)
python是否具有完成上述代码之类的功能?
我有一个在Linux上编译好的脚本(Ubuntu 11.04),但在OS X(Lion)上却没有.
gcc -pthread -o hw1 hw1.c
hw1.c:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘barr’
hw1.c: In function ‘__syncthreads’:
hw1.c:53: error: ‘barr’ undeclared (first use in this function)
hw1.c:53: error: (Each undeclared identifier is reported only once
hw1.c:53: error: for each function it appears in.)
hw1.c:54: error: ‘PTHREAD_BARRIER_SERIAL_THREAD’ undeclared (first use in this function)
hw1.c: In function ‘parallel_psum’:
hw1.c:94: error: ‘barr’ undeclared (first use in this function)
hw1.c:107: warning: assignment from incompatible pointer type
Run Code Online (Sandbox Code Playgroud)
这是代码的前22行:
#include …Run Code Online (Sandbox Code Playgroud) 我想在存储在S3上的Elastic Map Reduce作业输出上使用LZO压缩,但不清楚文件是否自动编入索引,以便将来对该数据运行的作业会将文件拆分为多个任务.
例如,如果我的输出是一堆TSV数据行,在1GB LZO文件中,未来的地图作业将只创建1个任务,或类似(1GB/blockSize)任务(即文件未压缩时的行为) ,或者如果目录中有LZO索引文件)?
编辑:如果没有自动完成,建议将输出设为LZO索引?在将文件上传到S3 之前进行索引编制?
我用Yarn下载了Hadoop的CDH4 tar,并且作业运行良好,但我无法弄清楚从我的工作中查看日志的位置.在MRv1中,我只是去了JobTracker网络应用程序,它有工作历史.单个作业的日志也可以从这里访问,或者转到logs/userlogs目录.
在我的新Yarn设置中(仅在单台计算机上运行),我有logs目录,但没有logs/userlogs文件夹.
当我进入ResourceManager网页localhost:8088时,有一个"所有应用程序"部分,但此处没有显示任何条目.当我转到JobHistory网页localhost:19888时,没有列出任何作业.
我想知道是否存在配置问题.这是我的yarn-site.xml条目:
<property>
<name>yarn.nodemanager.local-dirs</name>
<value>/Users/dolan/cdh4/_hadoop_data/yarn/local</value>
</property>
<property>
<name>yarn.nodemanager.log-dirs</name>
<value>/Users/dolan/cdh4/_hadoop_data/yarn/logs</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>localhost:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>localhost:19888</value>
</property>
<property>
<name>yarn.app.mapreduce.am.staging-dir</name>
<value>/user</value>
</property>
Run Code Online (Sandbox Code Playgroud)
任何有关调试内容的提示都非常感谢.
更新:我已经检查了nodemanager日志目录,它是空的.此外,jobhistory目录为空.一个奇怪的事情是Hadoop告诉我,INFO mapreduce.Job: The url to track the job: http://localhost:8080/但是当我从浏览器尝试时,该地址不可用.
更新#2:我注意到我运行的每个作业都有相同的作业ID("job_local_0001").这似乎是一个配置问题.
我有一个使用Docker Compose创建的Django环境,我正在尝试manage.py collectstatic将我的站点的静态文件复制到容器中的目录.这个目录(/ usr/src/app/static)也是一个Docker Volume.
在构建我的docker containers(docker-compose build)之后,我运行docker-compose run web python manage.py collectstatic,它按预期工作,但我的Web服务器(Nginx)没有找到文件,我运行时也没有任何文件docker-compose run web ls -la /usr/src/app/static.
关于我做错了什么的任何想法?
(注意:manage.py collectstatic我的Dockerfile中没有,因为我的设置需要加载我的".env"文件,我没有看到在Dockerfile中加载它的方法.在任何一种情况下,我想知道为什么Docker Compose不起作用,因为我期待它.)
这是我的配置文件:
## docker-compose.yml:
web:
restart: always
build: .
expose:
- "8000"
links:
- postgres:postgres
volumes:
- /usr/src/app/static
- .:/code
env_file: .env
command: /usr/local/bin/gunicorn myapp.wsgi:application -w 2 -b :8000 --reload
nginx:
restart: always
build: ./config/nginx
ports:
- "80:80"
volumes:
- /www/static
volumes_from:
- web
links:
- web:web
postgres:
restart: …Run Code Online (Sandbox Code Playgroud) Docker 新手,尝试使用 Compose 设置一个简单的 Django 项目。我过去曾在这方面取得过成功,但这次我尝试了不同的设置,我不明白为什么它不起作用。
我有以下 docker-compose.yml 文件:
data:
image: postgres:9.4
volumes:
- /var/lib/postgresql
command: /bin/true
db:
image: postgres:9.4
restart: always
expose:
- "5432"
volumes_from:
- data
app:
build: .
restart: always
env_file: .env
expose:
- "8000"
links:
- db:db
volumes:
- .static:/static_files
web:
build: docker/web
restart: always
ports:
- "80:80"
links:
- app:app
volumes_from:
- app
Run Code Online (Sandbox Code Playgroud)
我的 /Dockerfile 是:
FROM python:3.5
ENV PYTHONUNBUFFERED 1
ADD . /app
WORKDIR /app
RUN pip install -r requirements.txt
RUN SECRET_KEY=tmpkey …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行Hadoopy,但在OS X上遇到编译错误:
ImportError: Building module failed: ["CompileError: command 'llvm-gcc-4.2' failed with exit status 1\n"
Run Code Online (Sandbox Code Playgroud)
我有/Developer/usr/bin我的$PATH,并在OS X Lion 10.7上运行最新版本的XCode.Cython是通过安装的easy_install.
全输出:
>>> import pyximport; pyximport.install()
>>> import hadoopy
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:236:22: error: getdelim.h: No such file or directory
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:236:22: error: getdelim.h: No such file or directory
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c: In function ‘__pyx_f_7hadoopy_5_main_11HadoopyTask_read_offset_value_text’:
/Users/dolan/.pyxbld/temp.macosx-10.7-intel-2.7/pyrex/hadoopy/_main.c:4399: warning: implicit conversion shortens 64-bit value into a 32-bit value
lipo: can't open input file: /var/folders/8b/n0j5pn_13qn_x8p2v4f848zh0000gn/T//ccC8x2Ex.out (No such file or directory)
Traceback (most recent call …Run Code Online (Sandbox Code Playgroud) 当我尝试在Mac OS X 10.8.1 Mountain Lion上构建PIL时,我得到以下结果:
$ sudo python setup.py install
Password:
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
_imaging.c:75:10: fatal error: 'Python.h' file not …Run Code Online (Sandbox Code Playgroud) 我正在使用带有 MRv1 的 CDH4。据我所知,没有用于检查已完成作业的“状态”的命令行工具。当我转到 Web 控制台作业详细信息页面时,我可以看到“状态:失败”或“状态:成功”。如果我运行mapred job -list all或mapred job -status job_201309231203_0011,既不指示“失败”或“成功”。
我错过了其他一些命令吗?