脚本和非常大的文件我有一个脚本可以导入许多文件并将它们连接起来。
该文件可以超过 4100 万行,并且可以达到 10 千兆位(我有 100 GB 可用空间和 128GB 内存:使用 JMP16.2)
然后我有脚本来选择行和列等。我的问题实际上不是关于脚本本身,而是为什么如果我按顺序运行每个脚本而不是包含所有脚本的脚本,JMP“挂起”。
例如, 一切似乎都正常,如果我按顺序运行每个 JSL,它就会正常工作
1.Concat_files.JSL
2.Change_Test_Instance_Name.JSL
3.Summarize_Test_Instance.JSL
与
为我运行上述每一个脚本的脚本......
例如,
运行所有脚本.JSL
包括(“ADDIN_HOME(my_scripts)\Concat_files.jsl”);
包括((“ADDIN_HOME(my_scripts)\Change_Test_Instance_Name.JSL”);
包括(“ADDIN_HOME(my_scripts)\Summarize_Test_Instance.JSL.jsl”);
这只是挂起我的系统......我打开了日志,我可以看出它卡在下一个脚本中(日志显示一条显示语句,如 show("Entering Change_Test_Instance name");
我尝试过使用 wait();每个包含之间的语句(以及每个脚本内),但这仍然不起作用。还有什么我应该尝试的吗?
自动化和脚本编写回复:脚本和非常大的文件抱歉回复晚了(工作忙)。
感谢您的想法。我从来没有使用过调试器。
我也会看看命名空间的想法。我还发现,如果我打开主 DT(它已连接),然后使用 include 语句运行脚本,它也会像我按原样运行脚本时一样快(不包括)。因此,主数据表在内存中一段时间与连接然后立即运行包含脚本有关。
回复:脚本和非常大的文件您也许可以使用 JSL 调试器/分析器运行代码,或者像您一样使用更细粒度的 time_start..time_end 来检测它。 我的猜测是,由于某些原因,代码具有 N^2 行为(将数据加倍的 4 倍时间)。 可能是某个名称与数据表中的名称冲突的名称空间问题。
一个可能不好的地方是
dt_summary << select where( Contains( Test_names, :Test_Instance ) );
但如果不计时就很难知道。 如果 Test_names 可能有 1e6 个项目,而 dt_summary 可能有 1e6 行,则平均每 1e6 行将检查 500,000 个 test_name。 或者也许只有 10 个左右,这不是问题。 你可能想重写它,大约像这样
// untested. combine two loops and use an aa rather than a list for lookup
Test_names = AssociativeArray();
For Each Row(
If( ( Contains( dt_summary:Test_Instance, "CHAR_char" )),
Test_names[ dt_summary:Test_Instance ] = 1
)
);
dt_summary << select where( Test_names<<CONTAINS></CONTAINS>
如果列表有数百个项目,关联数组会快得多。
如果您想使用 JSL 分析器,请不要为您的第一次分析体验运行 3 小时。尝试使用包含的小程序,并确保使用这些按钮:
Something in the toolboxSomething in the toolbox工具箱里有东西
A new window opens, the clock is for timing JSL.A new window opens, the clock is for timing JSL.将打开一个新窗口,时钟用于为 JSL 计时。
The tooltip for the icon says "run profiler".The tooltip for the icon says "run profiler".该图标的工具提示显示“运行分析器”。
您也许可以使用蓝色暂停按钮或等待其结束,然后检查热点:
tabs for sourcestabs for sources来源选项卡
tabs for sourcestabs for sources来源选项卡
回复:脚本和非常大的文件看起来我粘贴了相同的日志......
这是独自跑步时...200秒或约3.33分钟
N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 15Feb2022:10:11:57;
"Reducing Test Instances Ended";
As Date(Today()) = 15Feb2022:10:15:17;
start_time - As Date(Today()) = -200;
回复:脚本和非常大的文件我让脚本运行以查看它是否被卡住(看起来它正在运行,但在脚本中运行时需要几个小时,而不是几分钟)。
我只在日志中显示语句。
这是在脚本中运行脚本的日志输出。(“更改为一个测试实例”需要 3.65 小时,而如果我自己在同一个文件上运行相同的脚本则需要 3.65 分钟)。CPU 在 3.65 小时内运行 12 个核心(CPU0 到 CPU11)约 20%
下面是日志和 JSL 的片段。
N Items(files_open) = 12;
"Files are Concatenated ";
As Date(Today()) = 14Feb2022:13:00:32;
start_time - As Date(Today()) = -492;
"Saving Digital_shmoo_all";
As Date(Today()) = 14Feb2022:13:00:54;
"Done Saving Digital_shmoo_all";
As Date(Today()) = 14Feb2022:13:01:24;
"Changing to one test instance";
N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 14Feb2022:13:01:39;
"Reducing Test Instances Ended";
As Date(Today()) = 14Feb2022:16:41:13;
start_time - As Date(Today()) = -13174;
"Transposing";
"File has been transposed";
As Date(Today()) = 14Feb2022:16:42:23;
start_time - As Date(Today()) = -69;
如果我使用相同的大文件单独运行reduce测试实例脚本,则日志如下
As Date(Today()) = 14Feb2022:13:01:24;
"Changing to one test instance";
N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 14Feb2022:13:01:39;
"Reducing Test Instances Ended";
As Date(Today()) = 14Feb2022:16:41:13;
start_time - As Date(Today()) = -13174;
"Transposing";
"File has been transposed";
As Date(Today()) = 14Feb2022:16:42:23;
start_time - As Date(Today()) = -69;
该脚本的基础知识是查找以“Char_Char”开头的名称并更改它们,以便它们没有“Char_Char”;为此,创建一个汇总表,选择汇总表中具有“Char_Char”的行,获取主表中选定的行,然后更改主表中的名称。这是慢速脚本的片段。
One_Test_Instance.JSL
dt = Current Data Table();
Names Default To Here( 1 );
Show( N Rows( dt ), "In Reduce_Test_Instance" );
Show( As Date( Today() ) );
start_time = As Date( Today() );
dt << clear select;
dt << clear column selection;
Wait();
Test_names = {};
dt << Summary(
Group( :Test_Instance ),
Freq( "None" ),
Weight( "None" ),
output table name( "Summary_of_Table" )
);
dt_summary = Current Data Table();
Wait();
For Each Row( Insert Into( Test_names, dt_summary:Test_Instance ) );
Wait();
For( i = N Items( Test_names ), i > 0, i--,
If( (!Contains( Test_names[i], "CHAR_char" )),
Remove From( Test_names, i )
)
);
dt_summary << select where( Contains( Test_names, :Test_Instance ) );
Wait();
aa = dt << get selected rows; //Get selected rows in main table
Wait();
Close( dt_summary, nosave );
If( N Rows( aa ) > 0,
(dt:Test_instance[aa]) = "CHAR_char_meas_TI";
(dt:Setup[aa]) = "meas_TI"; //Change name in main table
);
dt << clear select;
dt << clear column selection;
Wait();回复:脚本和非常大的文件您是否打开/关闭报告窗口,可能是 100 秒还是 1000 秒? 根本不打开窗户可能会有很大帮助。 (操作系统可能没有机会清理某些内容。)
您是否要将 1000 行打印到 JMP 16 日志中? 有一个使用旧日志格式的偏好可能会有所帮助。
任务管理器可能会提供一些见解。 查看句柄和 GDI 对象以及明显的内存和磁盘罪魁祸首。
或者检查计算机前面的磁盘指示灯(如果有)。 听起来你不应该进行寻呼,那是一台很好的计算机!
我想知道当你得到答案时发生了什么;如果以上都没有帮助,技术支持也可以提供帮助。