Форум программистов, компьютерный форум, киберфорум
Batch (CMD/BAT)
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.87/54: Рейтинг темы: голосов - 54, средняя оценка - 4.87
0 / 0 / 0
Регистрация: 11.09.2016
Сообщений: 19
1

Одновременное выполнение

29.09.2016, 00:57. Показов 9987. Ответов 1
Метки bat (Все метки)

Author24 — интернет-сервис помощи студентам
работаю с monkeyrunner.bat , он запускает python Скрипты на андройде.
Windows Batch file
1
Monkeyrunner путь_до_скрипта.py
Но если запускаю 2 или более скриптов
они выполняются последовательно.Это отнимает много времени. Можно ли это как то обойти. Вот батник.
Windows Batch file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@echo off
rem Copyright (C) 2010 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
 
rem don't modify the caller's environment
setlocal
 
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
 
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
 
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
 
set jarfile=monkeyrunner.jar
set frameworkdir=.
set libdir=
 
if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=lib
 
if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=..\framework
 
:JarFileOk
 
set jarpath=%frameworkdir%\%jarfile%
 
if not defined ANDROID_SWT goto QueryArch
    set swt_path=%ANDROID_SWT%
    goto SwtDone
 
:QueryArch
 
    for /f "delims=" %%a in ('"%java_exe%" -jar %frameworkdir%\archquery.jar') do set swt_path=%frameworkdir%\%%a
 
:SwtDone
 
if exist "%swt_path%" goto SetPath
    echo SWT folder '%swt_path%' does not exist.
    echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
    exit /B
 
:SetPath
 
call "%java_exe%" -Xmx512m "-Djava.ext.dirs=%frameworkdir%;%swt_path%" -Dcom.android.monkeyrunner.bindir=..\framework -jar %jarpath% %*
кода я его запускаю в диспетчере задач выходят процессы java
Как сделать что бы они выполнялись одновременно если запущенно более одного monkeyrunner.
Какие есть решения ? Спасибо

Добавлено через 13 минут
Вот jar.bat
Кликните здесь для просмотра всего текста
Windows Batch file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@echo off
rem Copyright (C) 2007 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
 
rem This script is called by the other batch files to find a suitable Java.exe
rem to use. The script changes the "java_exe" env variable. The variable
rem is left unset if Java.exe was not found.
 
rem Useful links:
rem Command-line reference:
rem   [url]http://technet.microsoft.com/en-us/library/bb490890.aspx[/url]
 
rem Query whether this system is 32-bit or 64-bit
rem Note: Some users report that reg.exe is missing on their machine, so we
rem check for that first, as we'd like to use it if we can.
set sys_32=%SYSTEMROOT%\system32
if exist %sys_32%\reg.exe (
    rem This first-pass solution returns the correct architecture even if you
    rem call this .bat file from a 32-bit process.
    rem See also: [url]http://stackoverflow.com/a/24590583/1299302[/url]
    %sys_32%\reg query "HKLM\Hardware\Description\System\CentralProcessor\0"^
    | %sys_32%\find /i "x86" > NUL && set arch_ext=32|| set arch_ext=64
) else (
    rem This fallback approach is simpler, but may misreport your architecture as
    rem 32-bit if running from a 32-bit process. Still, it should serve to help
    rem our users without reg.exe, at least.
    if "%PROCESSOR_ARCHITECTURE%" == "x86" (set arch_ext=32) else (set arch_ext=64)
)
 
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%%a
if not defined java_exe goto :CheckFailed
 
:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s -w') do set javaw_exe=%%a
if not exist "%javaw_exe%" set javaw_exe=%java_exe%
goto :EOF
 
 
:CheckFailed
echo.
echo ERROR: No suitable Java found. In order to properly use the Android Developer
echo Tools, you need a suitable version of Java JDK installed on your system.
echo We recommend that you install the JDK version of JavaSE, available here:
echo   [url]http://www.oracle.com/technetwork/java/javase/downloads[/url]
echo.
echo If you already have Java installed, you can define the JAVA_HOME environment
echo variable in Control Panel / System / Avanced System Settings to point to the
echo JDK folder.
echo.
echo You can find the complete Android SDK requirements here:
echo   [url]http://developer.android.com/sdk/requirements.html[/url]
echo.
goto :EOF
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
29.09.2016, 00:57
Ответы с готовыми решениями:

Возможно ли: выполнение подпрограммы в отдельном процессе, одновременное выполнение двух подпрограмм?
Всех приветствую :handshake: Пример @echo off call :PROG1 call :PROG2 exit /b :PROG1

Одновременное выполнение
Здравствуйте, скажите пожалуйста как можно одновременно выполнить две операции Например, вот ...

Одновременное выполнение действий
Доброго. Пишу что-то отдаленно напоминающее игру марио, используя windows forms. Нужно сделать, ...

Одновременное выполнение 3 действий
Мне нужно одновременное выполнение 3 действий: Проигрывание гиф Вывод динамического текста в...

1
Эксперт WindowsАвтор FAQ
17996 / 7697 / 892
Регистрация: 25.12.2011
Сообщений: 11,470
Записей в блоге: 16
06.10.2016, 00:09 2
Для этого нужно разбираться как работает

Цитата Сообщение от froa Посмотреть сообщение
call "%java_exe%" -Xmx512m "-Djava.ext.dirs=%frameworkdir%;%swt_path%" -Dcom.android.monkeyrunner.bindir=..\framework -jar %jarpath% %*
Если всё и правда так, как вы говорите, то это в самом скрипте java-ы прописана синхронизация.

Хотя вы не написали, каким образом вызываете несколько скриптов.
Может, достаточно сделать что-то вроде:

Windows Batch file
1
2
start "" Monkeyrunner путь_до_скрипта_1.py
start "" Monkeyrunner путь_до_скрипта_2.py
0
06.10.2016, 00:09
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
06.10.2016, 00:09
Помогаю со студенческими работами здесь

Одновременное выполнение команд
Подскажите можно ли в Delphi и если можно то как реалиовать одновремменое выполнение. Допустим на...

Одновременное выполнение оператора if
Здравствуйте, господа. Есть код: if (AreAllAvailable("login.p1.worldoftanks.net")) ...

2 формулы и одновременное выполнение
Доброго всем дня! Есть необходимость расчета стоимости по разным критериям исходя из поиска в...

Одновременное выполнение потоков
Выполняются по очереди и только после второго нажатия на кнопку происходит сортировка из-за этого...

Одновременное выполнение всех циклов
Доброго времени суток! Имеется цикл, который определенное количесво раз выполняет одни и теже...

асинхронные запросы (одновременное выполнение)
Доброго времени суток. Вопрос следующего характера: я отсылаю на сервер асинхронный запрос,...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru