span8
span4
你好,
我正在处理将近200K的记录,这些记录有30多个属性,在我的工作流程中,我用AttributeValidator验证它们是否是唯一的属性。亚搏在线这个验证大约需要4020秒。
在执行这样的验证时,有没有其他的转换器比这个更快呢?
PD:我在运行工作区之后添加了配置文件结果。
谢谢
更新:@MattAt亚搏在线Safe
我添加了只使用验证的简化工作空间。这个过程只需要17分钟的198k记录而已。
这里:我上传了我用来测试谷歌驱动器的文件,因为它太重了。
https://drive.google.com/open?id=0B44BAUsLmbR8ZVkxRGl6SGotNGc
任何帮助将不胜感激
我做了一些测试,看看在PrepareFields (AttributeManager)转换器中是什么花了这么长时间。
我使用FME 2017.1并分析了以下各点:
1-关闭了所有经过复印机的文件
删除了PrepareFields中的属性调整
3-在DataMapping PythonCaller中添加属性修整,使用属性列表的集合进行修剪
此时,我只是试图确定PrepareFields中的特定任务所花费的时间
4-删除正则表达式在PrepareFields
删除了在PrepareFields中创建的两个日期相关的属性
在PrepareFields中删除了条件日期的创建
此时,PrepareFields中仅剩下ReplaceString和大写调用。
步 | 定时器背景 | 用户CPU时间 |
1 |
FileReader_PrepareFields | 284.499024 |
1 | f_4 (PythonCaller) | 111.447114 |
2 | FileReader_PrepareFields | 223.611833 |
2 | f_4 (PythonCaller) | 112.33632 |
3. | FileReader_PrepareFields | 222.379425 |
3. | f_4 (PythonCaller) | 117.624754 |
4 | FileReader_PrepareFields | 220.866216 |
4 | f_4 (PythonCaller) | 118.935162 |
5 | FileReader_PrepareFields | 99.87184 |
5 | f_4 (PythonCaller) | 115.48754 |
6 | FileReader_PrepareFields | 40.029857 |
6 | f_4 (PythonCaller) | 115.955543 |
也许使用一些特定的转换器(如AttributeTrimmer)是第一步,但是您看起来很适合使用python,如果您的目标是获得最佳性能,那么使用python进行数据处理是值得的。
最新版本的python代码:
fme进口fmeobjects进口进口:json #模板函数接口:#使用这个函数时,确保它的名字是#的值设置为类或函数过程特性的变压器参数def processFeature(特性):通过#模板类接口:#使用这个类时,确保它的名字是#的值设置为类或函数过程特性的变压器参数类FeatureProcessor(对象):def __init__(自我):自我。self.loadFields()传递def loadFields(self): self。customFieldsAttributes = {} self。sourceAttributes = {} for field in self.dataMapping: source = field['sourceColumn'] destiny = field['id'] if field['isCustom']: self.customFieldsAttributes[source] = destiny else: self.sourceAttributes[source] = destiny self.attributesToTrim = ['ATTENDING_SCHOOL_CODE', 'ZONED_SCHOOL_CODE', 'ENROLLED_SCHOOL_CODE', 'SUMMER_SCHOOL_CODE', 'STUDENT_ID', 'GRADE_CODE', 'GENDER', 'ETHNICITY_CODE', 'DATE_OF_BIRTH', 'STREET', 'SPECIAL_,ED' 'WHEEL_CHAIR', 'SAFETY_VEST_HARNESS', 'SEATBELT', 'CAR_SEAT', 'BOOSTER_SEAT', 'WALKER', 'TINTED_WINDOWS', 'AIR_COND', 'AIDE_REQ', 'NURSE', 'OXYGEN', 'SERVICE_ANIMAL'] def input(self,feature): newFeature = fmeobjects.FMEFeature() customs = [] #We read all column names of the incoming feature incomingColumnNames = feature.getAllAttributeNames() for sourceField in incomingColumnNames: #Trim fields if sourceField in self.attributesToTrim: feature.setAttribute(sourceField, feature.getAttribute(sourceField).strip()) #If the source field we stored in the array to convert it in JSON Later cellValue = feature.getAttribute(sourceField) if sourceField in self.customFieldsAttributes.keys(): destiny = self.customFieldsAttributes[sourceField] # we map the sourceColumn to id customs.append({ 'key': destiny, 'value': cellValue }) else: if sourceField in self.sourceAttributes.keys(): destiny = self.sourceAttributes[sourceField] # we map the sourceColumn to id newFeature.setAttribute(destiny, cellValue) newFeature.setAttribute('custom_fields_json', json.dumps(customs)) newFeature.setAttribute('csv_line_number', feature.getAttribute('csv_line_number')) #csv_line_number comes as feature after reading the file self.pyoutput(newFeature) def close(self): pass
嗨@rrdlpl4000秒非常慢!!您可以尝试使用复印机来代替AttributeValidator。你可能会发现这是更有效的,因为我认为它会以不同的方式工作。您能与我们共享工作空间和原始日志文件吗?
使用复印机可能不会给你真正想要的东西,但是,它应该给你一个开始的地方,并消除堵塞。
©2019安全亚搏在线软件公司法律