-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Melhoria no Uso de Threads e suporte a Lista de Professores em CSV (#6)
* [x] Melhorado uso de threads usando `ThreadPool` * [x] Opção de utilizar CSV como lista de professores para download/processamento
- Loading branch information
1 parent
8a8dea4
commit 7035601
Showing
37 changed files
with
3,031 additions
and
852 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,51 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> | ||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | ||
</configSections> | ||
<appSettings> | ||
<!-- Descomentar a linha abaixo para utilizar o REST service https://buscacv.cnpq.br --> | ||
<!-- <add key="UseNewCNPqRestService" value="true" /> --> | ||
|
||
<!-- Descomentar a linha abaixo para informar um CSV como lista de curriculos para importação --> | ||
<!-- <add key="CSVCurriculumValueNumberList" value="./resources/csv_list_sample.csv" /> --> | ||
|
||
<!-- Descomentar a linha abaixo caso deseje fazer a importação de uma pasta no lugar de baixar do Webservice do CNPq --> | ||
<!-- <add key="ImportFolder" value="resources/sample" /> --> | ||
<add key="TempDir" value="./.temp/cnpq" /> | ||
<add key="IgnorePedingLastExecution" value="false" /> | ||
<add key="LattesCurriculumVitaeODBCConnection" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.\resources\IDs_Curriculos.local.xls; Extended Properties='Excel 8.0;HDR=YES;'" /> | ||
|
||
<add key="TempDir" value="./.temp/cnpq"/> | ||
<add key="IgnorePedingLastExecution" value="false"/> | ||
<add key="LattesCurriculumVitaeODBCConnection" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.\resources\IDs_Curriculos.local.xls; Extended Properties='Excel 8.0;HDR=YES;'"/> | ||
<!-- Numero do Curriculo, Nome do Professor, Data Nascimento e CPF --> | ||
<add key="LattesCurriculumVitaeQuery" value="SELECT [numerocurriculo], [nomecompleto] FROM [ids_lattes$]" /> | ||
<add key="ClientSettingsProvider.ServiceUri" value="" /> | ||
<add key="LattesCurriculumVitaeQuery" value="SELECT [numerocurriculo], [nomecompleto] FROM [ids_lattes$]"/> | ||
<add key="ClientSettingsProvider.ServiceUri" value=""/> | ||
</appSettings> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> | ||
</startup> | ||
<system.serviceModel> | ||
<bindings> | ||
<basicHttpBinding> | ||
<binding name="WSCurriculoBinding" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:15:00" sendTimeout="00:03:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="50000000" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" /> | ||
<binding name="WSCurriculoBinding" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:15:00" sendTimeout="00:03:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="50000000" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"/> | ||
</basicHttpBinding> | ||
</bindings> | ||
<client> | ||
<endpoint address="http://servicosweb.cnpq.br/srvcurriculo/WSCurriculo?wsdl" binding="basicHttpBinding" bindingConfiguration="WSCurriculoBinding" contract="CurriculoLattesWebService.WSCurriculo" name="WSCurriculoPort" /> | ||
<endpoint address="http://servicosweb.cnpq.br/srvcurriculo/WSCurriculo?wsdl" binding="basicHttpBinding" bindingConfiguration="WSCurriculoBinding" contract="CurriculoLattesWebService.WSCurriculo" name="WSCurriculoPort"/> | ||
</client> | ||
</system.serviceModel> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | ||
<parameters> | ||
<parameter value="v12.0" /> | ||
<parameter value="v12.0"/> | ||
</parameters> | ||
</defaultConnectionFactory> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> | ||
</providers> | ||
</entityFramework> | ||
<connectionStrings> | ||
<!-- add name="LattesDatabase" connectionString="metadata=res://*/Entities.Database.LattesDatabase.csdl|res://*/Entities.Database.LattesDatabase.ssdl|res://*/Entities.Database.LattesDatabase.msl;provider=System.Data.SqlClient;provider connection string="data source=172.18.0.21;initial catalog=dblattes;integrated security=False;User ID=bob;Password=bob;;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /--> | ||
<add name="LattesDatabase" connectionString="metadata=res://*/Entities.Database.LattesDatabase.csdl|res://*/Entities.Database.LattesDatabase.ssdl|res://*/Entities.Database.LattesDatabase.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost\SQLEXPRESS;initial catalog=dblattes;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> | ||
<add name="LattesDatabase" connectionString="metadata=res://*/Entities.Database.LattesDatabase.csdl|res://*/Entities.Database.LattesDatabase.ssdl|res://*/Entities.Database.LattesDatabase.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost\SQLEXPRESS;initial catalog=dblattes;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/> | ||
</connectionStrings> | ||
</configuration> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LattesExtractor.Collections | ||
{ | ||
// https://codereview.stackexchange.com/questions/32500/golang-channel-in-c#answer-32510 | ||
public class Channel<T> | ||
{ | ||
private BlockingCollection<T> _buffer; | ||
|
||
public Channel() : this(1) { } | ||
|
||
public Channel(int size) | ||
{ | ||
_buffer = new BlockingCollection<T>(new ConcurrentQueue<T>(), size); | ||
} | ||
|
||
public bool Send(T t) | ||
{ | ||
try | ||
{ | ||
_buffer.Add(t); | ||
} | ||
catch (InvalidOperationException) | ||
{ | ||
// will be thrown when the collection gets closed | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public bool Receive(out T val) | ||
{ | ||
try | ||
{ | ||
val = _buffer.Take(); | ||
} | ||
catch (InvalidOperationException) | ||
{ | ||
// will be thrown when the collection is empty and got closed | ||
val = default(T); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public void Close() | ||
{ | ||
_buffer.CompleteAdding(); | ||
} | ||
|
||
public IEnumerable<T> Range() | ||
{ | ||
while (Receive(out T val)) | ||
{ | ||
yield return val; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.