我目前正在开发一个AJAX文件上传脚本,它在Firefox中像魅力一样,但在IE中不起作用.
这是我正在使用的基本HTML:
<form >
<input type="file" name="FileFields" id="FileFields"/>
<button type="button" onclick="uploadFile();" id="uploadButton">Upload</button>
<ul id="files"/>
... other form elements ...
</form>
<div id="fileUploadDiv"/>
Run Code Online (Sandbox Code Playgroud)
这是uploadFile函数:
function uploadFile()
{
//we don't want more then 5 files uploaded
if($('#files li').size() >= 5)
{
return;
}
//disable the upload button
$('#uploadButton').attr('disabled','disabled');
//show loading animation
$('#files').append(
$('<li>')
.attr('id','loading')
.append(
$('<img>').attr('src','/images/loading.gif')
)
.addClass('loading')
);
//add all neccessary elements (the form and the iframe)
$('#fileUploadDiv').append(
$('<form action="/uploadFile" method="post" id="fileUploadForm">')
.attr('enctype','multipart/form-data')
.attr('encoding', 'multipart/form-data')
.attr('target', 'upload_frame')
.append(
$('#FileFields').clone()
.css('visibility','hidden')
) …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试运行数据流(Apache Beam,Python SDK)任务,以将大于100GB的Tweet文件导入BigQuery,但正在 Error: Message: Too many sources provided: 15285. Limit is 10000.
该任务将使用tweet(JSON),提取5个相关字段,并通过一些转换对它们进行一些转换/消毒,然后将这些值写入BigQuery,以用于进一步处理。
BigQuery有Cloud Dataflow-来源过多,但这似乎是由于输入文件过多而引起的,而我只有一个输入文件,因此似乎无关紧要。另外,这里提到的解决方案是很神秘的,我不确定是否/如何将它们应用于我的问题。
我的猜测是,BigQuery在持久存储之前为每一行或其他内容写入临时文件,这就是“太多源”的含义吗?
我怎样才能解决这个问题?
[编辑]
码:
import argparse
import json
import logging
import apache_beam as beam
class JsonCoder(object):
"""A JSON coder interpreting each line as a JSON string."""
def encode(self, x):
return json.dumps(x)
def decode(self, x):
return json.loads(x)
def filter_by_nonempty_county(record):
if 'county_fips' in record and record['county_fips'] is not None:
yield record
def run(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('--input',
default='...',
help=('Input twitter json …Run Code Online (Sandbox Code Playgroud)