Skocz do zawartości

[perl] Moduł Thread::pool


menth0l

Rekomendowane odpowiedzi

Piszę sobie właśnie program w perlu oparty o wątki. W pewnym momencie stwierdziłem, że potrzeba mi modułu Thread::Pool. Zdziwiło mnie gdy w repozytoriach nie znalazłem odpowiedniej paczki (bodajże perl-Thread-Pool). Po przeszukaniu googla ze zdziwieniem stwierdziłem, że najnowsze wersje tej paczki istnieją dla... Fedory 8. I tu nasuwa się pierwsze pytanie: czyżby zrezygnowano z paczkowania niektórych modułów perla? I od czego w takim razie zależy jakie moduły pojawiają się w repo fedory?

 

No cóż, stwierdziłem, że pora użyć narzędzi dostarczonych przez samego perla:

$# perl -MCPAN -e shell

 

Oto co dostałem na wyjściu:

cpan[1]> install Thread::Pool
CPAN: Storable loaded ok (v2.18)
Going to read '/root/.cpan/Metadata'
  Database was generated on Sat, 26 Dec 2009 06:35:26 GMT
CPAN: YAML loaded ok (v0.70)
Going to read 6 yaml files from /root/.cpan/build/
CPAN: Time::HiRes loaded ok (v1.9719)
DONE
Restored the state of none (in 0.1374 secs)
Running install for module 'Thread::Pool'
Running make for E/EL/ELIZABETH/Thread-Pool-0.32.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/Thread-Pool-0.32-nyVv1N
---- Unsatisfied dependencies detected during ----
----     ELIZABETH/Thread-Pool-0.32.tar.gz    ----
    Thread::Conveyor::Monitored [requires]
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes] 
Running make test
  Delayed until after prerequisites
Running make install
  make test had returned bad status, won't install without force
  Delayed until after prerequisites
Running install for module 'Thread::Conveyor::Monitored'
Running make for E/EL/ELIZABETH/Thread-Conveyor-Monitored-0.12.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/Thread-Conveyor-Monitored-0.12-nb25HO
  Has already been made
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Conveyor-Monitored01.t .. 1/67 # Monitoring to array
# 10 boxes optimized for cpu
# 100 boxes optimized for cpu
# 1000 boxes optimized for cpu
t/Conveyor-Monitored01.t .. 22/67 # 144 boxes optimized for cpu
# 10 boxes optimized for memory
# 100 boxes optimized for memory
# 1000 boxes optimized for memory
t/Conveyor-Monitored01.t .. 58/67 # 501 boxes optimized for memory
t/Conveyor-Monitored01.t .. 66/67 Scalars leaked: 1
t/Conveyor-Monitored01.t .. ok     
t/Conveyor-Monitored02.t .. 1/89 # Monitoring to file
# 10 boxes optimized for cpu
# 100 boxes optimized for cpu
# 1000 boxes optimized for cpu
# 390 boxes optimized for cpu
t/Conveyor-Monitored02.t .. 31/89 # 10 boxes optimized for memory
# 100 boxes optimized for memory
# 1000 boxes optimized for memory
t/Conveyor-Monitored02.t .. 58/89 # 402 boxes optimized for memory
Scalars leaked: 1
# Looks like you planned 89 tests but ran 73.
t/Conveyor-Monitored02.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
All 89 subtests passed 
t/Conveyor-Monitored03.t .. 2/102 # Monitoring with checkpoints
# 10 boxes optimized for cpu
# 11 boxes optimized for cpu
# 9 boxes optimized for cpu
# 100 boxes optimized for cpu
# 101 boxes optimized for cpu
# 99 boxes optimized for cpu
# 10 boxes optimized for memory
# 11 boxes optimized for memory
# 9 boxes optimized for memory
# 100 boxes optimized for memory
# 101 boxes optimized for memory
t/Conveyor-Monitored03.t .. 93/102 # 99 boxes optimized for memory
Scalars leaked: 1
t/Conveyor-Monitored03.t .. ok       

Test Summary Report
-------------------
t/Conveyor-Monitored02.t (Wstat: 65280 Tests: 89 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Tests out of sequence.  Found (2) but expected (3)
                Tests out of sequence.  Found (3) but expected (4)
                Tests out of sequence.  Found (4) but expected (5)
                Tests out of sequence.  Found (5) but expected (6)
                Tests out of sequence.  Found (3) but expected (7)
Displayed the first 5 of 87 TAP syntax errors.
Re-run prove with the -p option to see them all.
Files=3, Tests=258,  8 wallclock secs ( 0.12 usr  0.02 sys +  6.49 cusr  1.11 csys =  7.74 CPU)
Result: FAIL
Failed 1/3 test programs. 0/258 subtests failed.
make: *** [test_dynamic] Błąd 255
  ELIZABETH/Thread-Conveyor-Monitored-0.12.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports ELIZABETH/Thread-Conveyor-Monitored-0.12.tar.gz
Running make install
  make test had returned bad status, won't install without force
Running make for E/EL/ELIZABETH/Thread-Pool-0.32.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/Thread-Pool-0.32-nyVv1N
Warning: Prerequisite 'Thread::Conveyor::Monitored => 0.11' for 'ELIZABETH/Thread-Pool-0.32.tar.gz' failed when processing 'ELIZABETH/Thread-Conveyor-Monitored-0.12.tar.gz' with 'make_test => NO'. Continuing, but chances to succeed are limited.
  Has already been made
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Pool01.t .. 1/42 
#   Failed test 'use Thread::Pool;'
#   at t/Pool01.t line 17.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Test general functionality
at t/Pool01.t line 12
    main::__ANON__('Can\'t locate object method "list" via package "threads" at t...') called at t/Pool01.t line 19
# Looks like you planned 42 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool01.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 42/42 subtests 
t/Pool02.t .. 1/337 
#   Failed test 'use Thread::Pool;'
#   at t/Pool02.t line 19.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Test streaming to memory
at t/Pool02.t line 14
    main::__ANON__('Can\'t locate object method "list" via package "threads" at t...') called at t/Pool02.t line 21
# Looks like you planned 337 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool02.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 337/337 subtests 
t/Pool03.t .. 1/403 
#   Failed test 'use Thread::Pool;'
#   at t/Pool03.t line 18.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 5) line 2.
# BEGIN failed--compilation aborted at (eval 5) line 2.
# Test monitoring to file with checkpointing
at t/Pool03.t line 13
    main::__ANON__('Could not find file for \'Thread::Pool.pm\' at /usr/local/lib...') called at /usr/local/lib/perl5/site_perl/5.10.0/load.pm line 461
    load::_can('Thread::Pool', 'frequency') called at /usr/local/lib/perl5/site_perl/5.10.0/load.pm line 221
    load::AUTOLOAD('Thread::Pool', 10) called at t/Pool03.t line 19
# Looks like you planned 403 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool03.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 403/403 subtests 
t/Pool04.t .. 1/202 
#   Failed test 'use Thread::Pool;'
#   at t/Pool04.t line 18.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 5) line 2.
# BEGIN failed--compilation aborted at (eval 5) line 2.
# Test job throttling
at t/Pool04.t line 13
    main::__ANON__('Can\'t locate object method "list" via package "threads" at t...') called at t/Pool04.t line 20
# Looks like you planned 202 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool04.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 202/202 subtests 
t/Pool05.t .. 1/37 
#   Failed test 'use Thread::Pool;'
#   at t/Pool05.t line 17.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Test abort() functionality
at t/Pool05.t line 12
    main::__ANON__('Can\'t locate object method "list" via package "threads" at t...') called at t/Pool05.t line 19
# Looks like you planned 37 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool05.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 37/37 subtests 
t/Pool06.t .. 1/21 
#   Failed test 'use Thread::Pool;'
#   at t/Pool06.t line 19.
#     Tried to use 'Thread::Pool'.
#     Error:  Can't locate Thread/Conveyor/Monitored.pm in @INC (@INC contains: /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/arch /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# BEGIN failed--compilation aborted at /root/.cpan/build/Thread-Pool-0.32-nyVv1N/blib/lib/Thread/Pool.pm line 15.
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Test job submission from different threads
at t/Pool06.t line 12
    main::__ANON__('Can\'t locate object method "list" via package "threads" at t...') called at t/Pool06.t line 21
# Looks like you planned 21 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/Pool06.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 21/21 subtests 

Test Summary Report
-------------------
t/Pool01.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 42 tests but ran 1.
t/Pool02.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 337 tests but ran 1.
t/Pool03.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 403 tests but ran 1.
t/Pool04.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 202 tests but ran 1.
t/Pool05.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 37 tests but ran 1.
t/Pool06.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 21 tests but ran 1.
Files=6, Tests=6,  0 wallclock secs ( 0.05 usr  0.01 sys +  0.23 cusr  0.05 csys =  0.34 CPU)
Result: FAIL
Failed 6/6 test programs. 6/6 subtests failed.
make: *** [test_dynamic] Błąd 255
  ELIZABETH/Thread-Pool-0.32.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports ELIZABETH/Thread-Pool-0.32.tar.gz
Running make install
  make test had returned bad status, won't install without force
Failed during this command:
ELIZABETH/Thread-Conveyor-Monitored-0.12.tar.gz: make_test NO
ELIZABETH/Thread-Pool-0.32.tar.gz            : make_test NO

 

Nie poddałem się, spróbowałem jeszcze:

cpan[1]> notest install Thread::Pool

Tym razem musiałem jednak w ten sam sposób doinstalować zależności. Niby się zainstalowało ale po uruchomieniu programu w eclipse taki oto zestaw dostaję:

Insecure $ENV{PATH} while running with -T switch at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Serialize.pm line 28.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Tie/Thread.pm line 19.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Tie/Thread.pm line 19.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Tie.pm line 11.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Tie.pm line 13.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Conveyor.pm line 5.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Conveyor.pm line 5.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Conveyor/Monitored.pm line 15.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Conveyor/Monitored.pm line 15.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Pool.pm line 15.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.10.0/Thread/Pool.pm line 15.
Compilation failed in require at /home/menth0l/Projekty/perl/anomalies/threads3.pl line 8.
BEGIN failed--compilation aborted at /home/menth0l/Projekty/perl/anomalies/threads3.pl line 8.

 

Perla dopiero w zasadzie zaczynam i nie wiem teraz co z tym fantem zrobić. Potrzebuję modułu Thread::Pool! Jakieś sugestie?

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
×
×
  • Dodaj nową pozycję...