idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
118,800
private boolean shouldRemoveDataPullUpperBounds ( ) { if ( ! this . workUnitState . getPropAsBoolean ( ConfigurationKeys . SOURCE_QUERYBASED_ALLOW_REMOVE_UPPER_BOUNDS , true ) ) { return false ; } if ( ! partition . isLastPartition ( ) ) { return false ; } if ( partition . getHasUserSpecifiedHighWatermark ( ) || this ....
Check if it s appropriate to remove data pull upper bounds in the last work unit fetching as much data as possible from the source . As between the time when data query was created and that was executed there might be some new data generated in the source . Removing the upper bounds will help us grab the new data .
118,801
private void removeDataPullUpperBounds ( ) { log . info ( "Removing data pull upper bound for last work unit" ) ; Iterator < Predicate > it = predicateList . iterator ( ) ; while ( it . hasNext ( ) ) { Predicate predicate = it . next ( ) ; if ( predicate . getType ( ) == Predicate . PredicateType . HWM ) { log . info (...
Remove all upper bounds in the predicateList used for pulling data
118,802
private Iterator < D > getIterator ( ) throws DataRecordException , IOException { if ( Boolean . valueOf ( this . workUnitState . getProp ( ConfigurationKeys . SOURCE_QUERYBASED_IS_SPECIFIC_API_ACTIVE ) ) ) { return this . getRecordSetFromSourceApi ( this . schema , this . entity , this . workUnit , this . predicateLis...
Get iterator from protocol specific api if is . specific . api . active is false Get iterator from source specific api if is . specific . api . active is true
118,803
public void close ( ) { log . info ( "Updating the current state high water mark with " + this . highWatermark ) ; this . workUnitState . setActualHighWatermark ( new LongWatermark ( this . highWatermark ) ) ; try { this . closeConnection ( ) ; } catch ( Exception e ) { log . error ( "Failed to close the extractor" , e...
close extractor read stream update high watermark
118,804
public Extractor < S , D > build ( ) throws ExtractPrepareException { String watermarkColumn = this . workUnitState . getProp ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY ) ; long lwm = partition . getLowWatermark ( ) ; long hwm = partition . getHighWatermark ( ) ; log . info ( "Low water mark: " + lwm + "; and High ...
build schema record count and high water mark
118,805
private void setRangePredicates ( String watermarkColumn , WatermarkType watermarkType , long lwmValue , long hwmValue ) { log . debug ( "Getting range predicates" ) ; String lwmOperator = partition . isLowWatermarkInclusive ( ) ? ">=" : ">" ; String hwmOperator = ( partition . isLastPartition ( ) || partition . isHigh...
range predicates for watermark column and transaction columns .
118,806
public void modifyDatasetForRecompact ( State recompactState ) { if ( ! this . jobProps ( ) . getPropAsBoolean ( MRCompactor . COMPACTION_RECOMPACT_ALL_DATA , MRCompactor . DEFAULT_COMPACTION_RECOMPACT_ALL_DATA ) ) { this . overwriteInputPath ( this . outputLatePath ) ; this . cleanAdditionalInputPath ( ) ; } else { th...
Modify an existing dataset to recompact from its ouput path .
118,807
public void beforeConvert ( SO outputSchema , DI inputRecord , WorkUnitState workUnit ) { Instrumented . markMeter ( this . recordsInMeter ) ; }
Called before conversion .
118,808
public void afterConvert ( Iterable < DO > iterable , long startTimeNanos ) { Instrumented . updateTimer ( this . converterTimer , System . nanoTime ( ) - startTimeNanos , TimeUnit . NANOSECONDS ) ; }
Called after conversion .
118,809
protected Callback < Response < PermitAllocation > > decorateCallback ( PermitRequest request , Callback < Response < PermitAllocation > > callback ) { return callback ; }
Decorate the callback to intercept some responses .
118,810
public static List < Pattern > getPatternsFromStrings ( List < String > strings ) { List < Pattern > patterns = Lists . newArrayList ( ) ; for ( String s : strings ) { patterns . add ( Pattern . compile ( s ) ) ; } return patterns ; }
Convert a list of Strings to a list of Patterns .
118,811
public static boolean stringInPatterns ( String s , List < Pattern > patterns ) { for ( Pattern pattern : patterns ) { if ( pattern . matcher ( s ) . matches ( ) ) { return true ; } } return false ; }
Determines whether a string matches one of the regex patterns .
118,812
public List < HivePartitionDataset > findDatasets ( ) throws IOException { List < HivePartitionDataset > list = new ArrayList < > ( ) ; for ( HiveDataset hiveDataset : this . hiveDatasets ) { for ( Partition partition : hiveDataset . getPartitionsFromDataset ( ) ) { list . add ( new HivePartitionDataset ( partition ) )...
Will find all datasets according to whitelist except the backup trash and staging tables .
118,813
private void build ( ) { this . startNodes = new ArrayList < > ( ) ; this . endNodes = new ArrayList < > ( ) ; this . parentChildMap = new HashMap < > ( ) ; for ( DagNode node : this . nodes ) { if ( node . getParentNodes ( ) == null ) { this . startNodes . add ( node ) ; } else { List < DagNode > parentNodeList = node...
Constructs the dag from the Node list .
118,814
public InputStream decryptFile ( InputStream inputStream , String passPhrase ) throws IOException { PGPEncryptedDataList enc = getPGPEncryptedDataList ( inputStream ) ; PGPPBEEncryptedData pbe = ( PGPPBEEncryptedData ) enc . get ( 0 ) ; InputStream clear ; try { clear = pbe . getDataStream ( new JcePBEDataDecryptorFact...
Taking in a file inputstream and a passPhrase generate a decrypted file inputstream .
118,815
public InputStream decryptFile ( InputStream inputStream , InputStream keyIn , String passPhrase ) throws IOException { try { PGPEncryptedDataList enc = getPGPEncryptedDataList ( inputStream ) ; Iterator it = enc . getEncryptedDataObjects ( ) ; PGPPrivateKey sKey = null ; PGPPublicKeyEncryptedData pbe = null ; PGPSecre...
Taking in a file inputstream keyring inputstream and a passPhrase generate a decrypted file inputstream .
118,816
private PGPPrivateKey findSecretKey ( PGPSecretKeyRingCollection pgpSec , long keyID , String passPhrase ) throws PGPException { PGPSecretKey pgpSecKey = pgpSec . getSecretKey ( keyID ) ; if ( pgpSecKey == null ) { return null ; } return pgpSecKey . extractPrivateKey ( new JcePBESecretKeyDecryptorBuilder ( ) . setProvi...
Private util function that finds the private key from keyring collection based on keyId and passPhrase
118,817
private PGPEncryptedDataList getPGPEncryptedDataList ( InputStream inputStream ) throws IOException { if ( Security . getProvider ( BouncyCastleProvider . PROVIDER_NAME ) == null ) { Security . addProvider ( new BouncyCastleProvider ( ) ) ; } inputStream = PGPUtil . getDecoderStream ( inputStream ) ; JcaPGPObjectFactor...
Generate a PGPEncryptedDataList from an inputstream
118,818
@ SuppressWarnings ( "unchecked" ) public Iterator < String [ ] > downloadFile ( String file ) throws IOException { log . info ( "Beginning to download file: " + file ) ; final State state = fileBasedExtractor . workUnitState ; CSVReader reader ; try { if ( state . contains ( DELIMITER ) ) { String delimiterStr = state...
Provide iterator via OpenCSV s CSVReader . Provides a way to skip top rows by providing regex . ( This is useful when CSV file comes with comments on top rows but not in fixed size . It also provides validation on schema by matching header names between property s schema and header name in CSV file .
118,819
public WorkUnitStream transform ( Function < WorkUnit , WorkUnit > function ) { if ( this . materializedWorkUnits == null ) { return new BasicWorkUnitStream ( this , Iterators . transform ( this . workUnits , function ) , null ) ; } else { return new BasicWorkUnitStream ( this , null , Lists . newArrayList ( Lists . tr...
Apply a transformation function to this stream .
118,820
public WorkUnitStream filter ( Predicate < WorkUnit > predicate ) { if ( this . materializedWorkUnits == null ) { return new BasicWorkUnitStream ( this , Iterators . filter ( this . workUnits , predicate ) , null ) ; } else { return new BasicWorkUnitStream ( this , null , Lists . newArrayList ( Iterables . filter ( thi...
Apply a filtering function to this stream .
118,821
public void printTable ( ) { if ( this . labels != null ) { System . out . printf ( this . rowFormat , this . labels . toArray ( ) ) ; } for ( List < String > row : this . data ) { System . out . printf ( this . rowFormat , row . toArray ( ) ) ; } }
Prints the table of data
118,822
private List < Integer > getColumnMaxWidths ( ) { int numCols = data . get ( 0 ) . size ( ) ; int [ ] widths = new int [ numCols ] ; if ( this . labels != null ) { for ( int i = 0 ; i < numCols ; i ++ ) { widths [ i ] = this . labels . get ( i ) . length ( ) ; } } for ( List < String > row : this . data ) { for ( int i...
A function for determining the max widths of columns accounting for labels and data .
118,823
private String getRowFormat ( List < Integer > widths ) { StringBuilder rowFormat = new StringBuilder ( spaces ( this . indentation ) ) ; for ( int i = 0 ; i < widths . size ( ) ; i ++ ) { rowFormat . append ( "%" ) ; rowFormat . append ( this . flags != null ? this . flags . get ( i ) : "" ) ; rowFormat . append ( wid...
Generates a simple row format string given a set of widths
118,824
private void copyJarDependencies ( State state ) throws IOException { if ( this . tmpJobDir == null ) { throw new RuntimeException ( "Job directory is not created" ) ; } if ( ! state . contains ( ConfigurationKeys . JOB_JAR_FILES_KEY ) ) { return ; } LocalFileSystem lfs = FileSystem . getLocal ( HadoopUtils . getConfFr...
Copy dependent jars to a temporary job directory on HDFS
118,825
public void executeQueries ( List < String > queries , Optional < String > proxy ) throws SQLException { Preconditions . checkArgument ( ! this . statementMap . isEmpty ( ) , "No hive connection. Unable to execute queries" ) ; if ( ! proxy . isPresent ( ) ) { Preconditions . checkArgument ( this . statementMap . size (...
Execute queries .
118,826
public long getRecordCount ( Path filepath ) { String [ ] components = filepath . getName ( ) . split ( Pattern . quote ( SEPARATOR ) ) ; Preconditions . checkArgument ( components . length >= 2 && StringUtils . isNumeric ( components [ components . length - 2 ] ) , String . format ( "Filename %s does not follow the pa...
The record count should be the last component before the filename extension .
118,827
private R2Request < GenericRecord > buildWriteRequest ( BufferedRecord < GenericRecord > record ) { if ( record == null ) { return null ; } R2Request < GenericRecord > request = new R2Request < > ( ) ; HttpOperation httpOperation = HttpUtils . toHttpOperation ( record . getRecord ( ) ) ; URI uri = HttpUtils . buildURI ...
Build a request from a single record
118,828
public AzkabanClientStatus createProject ( String projectName , String description ) throws AzkabanClientException { AzkabanMultiCallables . CreateProjectCallable callable = AzkabanMultiCallables . CreateProjectCallable . builder ( ) . client ( this ) . projectName ( projectName ) . description ( description ) . build ...
Creates a project .
118,829
public AzkabanClientStatus deleteProject ( String projectName ) throws AzkabanClientException { AzkabanMultiCallables . DeleteProjectCallable callable = AzkabanMultiCallables . DeleteProjectCallable . builder ( ) . client ( this ) . projectName ( projectName ) . build ( ) ; return runWithRetry ( callable , AzkabanClien...
Deletes a project . Currently no response message will be returned after finishing the delete operation . Thus success status is always expected .
118,830
public AzkabanClientStatus uploadProjectZip ( String projectName , File zipFile ) throws AzkabanClientException { AzkabanMultiCallables . UploadProjectCallable callable = AzkabanMultiCallables . UploadProjectCallable . builder ( ) . client ( this ) . projectName ( projectName ) . zipFile ( zipFile ) . build ( ) ; retur...
Updates a project by uploading a new zip file . Before uploading any project zip files the project should be created first .
118,831
public AzkabanExecuteFlowStatus executeFlowWithOptions ( String projectName , String flowName , Map < String , String > flowOptions , Map < String , String > flowParameters ) throws AzkabanClientException { AzkabanMultiCallables . ExecuteFlowCallable callable = AzkabanMultiCallables . ExecuteFlowCallable . builder ( ) ...
Execute a flow by providing flow parameters and options . The project and flow should be created first .
118,832
public AzkabanExecuteFlowStatus executeFlow ( String projectName , String flowName , Map < String , String > flowParameters ) throws AzkabanClientException { return executeFlowWithOptions ( projectName , flowName , null , flowParameters ) ; }
Execute a flow with flow parameters . The project and flow should be created first .
118,833
public AzkabanClientStatus cancelFlow ( String execId ) throws AzkabanClientException { AzkabanMultiCallables . CancelFlowCallable callable = AzkabanMultiCallables . CancelFlowCallable . builder ( ) . client ( this ) . execId ( execId ) . build ( ) ; return runWithRetry ( callable , AzkabanClientStatus . class ) ; }
Cancel a flow by execution id .
118,834
public AzkabanClientStatus fetchExecutionLog ( String execId , String jobId , String offset , String length , File ouf ) throws AzkabanClientException { AzkabanMultiCallables . FetchExecLogCallable callable = AzkabanMultiCallables . FetchExecLogCallable . builder ( ) . client ( this ) . execId ( execId ) . jobId ( jobI...
Fetch an execution log .
118,835
public AzkabanFetchExecuteFlowStatus fetchFlowExecution ( String execId ) throws AzkabanClientException { AzkabanMultiCallables . FetchFlowExecCallable callable = AzkabanMultiCallables . FetchFlowExecCallable . builder ( ) . client ( this ) . execId ( execId ) . build ( ) ; return runWithRetry ( callable , AzkabanFetch...
Given an execution id fetches all the detailed information of that execution including a list of all the job executions .
118,836
public AsyncDataWriter getAsyncDataWriter ( Properties properties ) { EventhubDataWriter eventhubDataWriter = new EventhubDataWriter ( properties ) ; EventhubBatchAccumulator accumulator = new EventhubBatchAccumulator ( properties ) ; BatchedEventhubDataWriter batchedEventhubDataWriter = new BatchedEventhubDataWriter (...
Create an eventhub data writer wrapped into a buffered async data writer
118,837
public PermitsAndDelay getPermitsAndDelay ( long requestedPermits , long minPermits , long timeoutMillis ) { try { long storedTokens = this . tokenBucket . getStoredTokens ( ) ; long eagerTokens = storedTokens / 2 ; if ( eagerTokens > requestedPermits && this . tokenBucket . getTokens ( eagerTokens , 0 , TimeUnit . MIL...
Request tokens .
118,838
public StreamCodec buildStreamEncryptor ( Map < String , Object > parameters ) { String encryptionType = EncryptionConfigParser . getEncryptionType ( parameters ) ; if ( encryptionType == null ) { throw new IllegalArgumentException ( "Encryption type not present in parameters!" ) ; } return buildStreamCryptoProvider ( ...
Return a StreamEncryptor for the given parameters . The algorithm type to use will be extracted from the parameters object .
118,839
public CredentialStore buildCredentialStore ( Map < String , Object > parameters ) { String ks_type = EncryptionConfigParser . getKeystoreType ( parameters ) ; String ks_path = EncryptionConfigParser . getKeystorePath ( parameters ) ; String ks_password = EncryptionConfigParser . getKeystorePassword ( parameters ) ; tr...
Build a credential store with the given parameters .
118,840
public String getCharset ( String contentType ) { String charSet = knownCharsets . get ( contentType ) ; if ( charSet != null ) { return charSet ; } if ( contentType . startsWith ( "text/" ) || contentType . endsWith ( "+json" ) || contentType . endsWith ( "+xml" ) ) { return "UTF-8" ; } return "BINARY" ; }
Check which character set a given content - type corresponds to .
118,841
public boolean inferPrintableFromMetadata ( Metadata md ) { String inferredCharset = "BINARY" ; List < String > transferEncoding = md . getGlobalMetadata ( ) . getTransferEncoding ( ) ; if ( transferEncoding != null ) { inferredCharset = getCharset ( transferEncoding . get ( transferEncoding . size ( ) - 1 ) ) ; } else...
Heuristic to infer if content is printable from metadata .
118,842
public void registerCharsetMapping ( String contentType , String charSet ) { if ( knownCharsets . contains ( contentType ) ) { log . warn ( "{} is already registered; re-registering" ) ; } knownCharsets . put ( contentType , charSet ) ; }
Register a new contentType to charSet mapping .
118,843
private static AuditCountClientFactory getClientFactory ( State state ) { if ( ! state . contains ( AuditCountClientFactory . AUDIT_COUNT_CLIENT_FACTORY ) ) { return new EmptyAuditCountClientFactory ( ) ; } try { String factoryName = state . getProp ( AuditCountClientFactory . AUDIT_COUNT_CLIENT_FACTORY ) ; ClassAliasR...
Obtain a client factory
118,844
private static Credential buildCredentialFromP12 ( String privateKeyPath , Optional < String > fsUri , Optional < String > id , HttpTransport transport , Collection < String > serviceAccountScopes ) throws IOException , GeneralSecurityException { Preconditions . checkArgument ( id . isPresent ( ) , "user id is required...
As Google API only accepts java . io . File for private key and this method copies private key into local file system . Once Google credential is instantiated it deletes copied private key file .
118,845
private static Path getPrivateKey ( FileSystem fs , String privateKeyPath ) throws IOException { Path keyPath = new Path ( privateKeyPath ) ; FileStatus fileStatus = fs . getFileStatus ( keyPath ) ; Preconditions . checkArgument ( USER_READ_PERMISSION_ONLY . equals ( fileStatus . getPermission ( ) ) , "Private key file...
Before retrieving private key it makes sure that original private key s permission is read only on the owner . This is a way to ensure to keep private key private .
118,846
public static HttpTransport newTransport ( String proxyUrl , String portStr ) throws NumberFormatException , GeneralSecurityException , IOException { if ( ! StringUtils . isEmpty ( proxyUrl ) && ! StringUtils . isEmpty ( portStr ) ) { return new NetHttpTransport . Builder ( ) . trustCertificates ( GoogleUtils . getCert...
Provides HttpTransport . If both proxyUrl and postStr is defined it provides transport with Proxy .
118,847
public EmbeddedGobblin mrMode ( ) throws IOException { this . sysConfigOverrides . put ( ConfigurationKeys . JOB_LAUNCHER_TYPE_KEY , JobLauncherFactory . JobLauncherType . MAPREDUCE . name ( ) ) ; this . builtConfigMap . put ( ConfigurationKeys . FS_URI_KEY , FileSystem . get ( new Configuration ( ) ) . getUri ( ) . to...
Specify job should run in MR mode .
118,848
public EmbeddedGobblin sysConfig ( String key , String value ) { this . sysConfigOverrides . put ( key , value ) ; return this ; }
Override a Gobblin system configuration .
118,849
public EmbeddedGobblin setConfiguration ( String key , String value ) { this . userConfigMap . put ( key , value ) ; return this ; }
Manually set a key - value pair in the job configuration .
118,850
public EmbeddedGobblin setJobTimeout ( String timeout ) { return setJobTimeout ( Period . parse ( timeout ) . getSeconds ( ) , TimeUnit . SECONDS ) ; }
Set the timeout for the Gobblin job execution from ISO - style period .
118,851
public EmbeddedGobblin setLaunchTimeout ( String timeout ) { return setLaunchTimeout ( Period . parse ( timeout ) . getSeconds ( ) , TimeUnit . SECONDS ) ; }
Set the timeout for launching the Gobblin job from ISO - style period .
118,852
public EmbeddedGobblin setShutdownTimeout ( String timeout ) { return setShutdownTimeout ( Period . parse ( timeout ) . getSeconds ( ) , TimeUnit . SECONDS ) ; }
Set the timeout for shutting down the Gobblin instance driver after the job is done from ISO - style period .
118,853
public EmbeddedGobblin useStateStore ( String rootDir ) { this . setConfiguration ( ConfigurationKeys . STATE_STORE_ENABLED , "true" ) ; this . setConfiguration ( ConfigurationKeys . STATE_STORE_ROOT_DIR_KEY , rootDir ) ; return this ; }
Enable state store .
118,854
public EmbeddedGobblin enableMetrics ( ) { this . usePlugin ( new GobblinMetricsPlugin . Factory ( ) ) ; this . sysConfig ( ConfigurationKeys . METRICS_ENABLED_KEY , Boolean . toString ( true ) ) ; return this ; }
Enable metrics . Does not start any reporters .
118,855
public JobExecutionResult run ( ) throws InterruptedException , TimeoutException , ExecutionException { JobExecutionDriver jobDriver = runAsync ( ) ; return jobDriver . get ( this . jobTimeout . getTimeout ( ) , this . jobTimeout . getTimeUnit ( ) ) ; }
Run the Gobblin job . This call will block until the job is done .
118,856
private void loadCoreGobblinJarsToDistributedJars ( ) { distributeJarByClassWithPriority ( State . class , 0 ) ; distributeJarByClassWithPriority ( ConstructState . class , 0 ) ; distributeJarByClassWithPriority ( InstrumentedExtractorBase . class , 0 ) ; distributeJarByClassWithPriority ( MetricContext . class , 0 ) ;...
This returns the set of jars required by a basic Gobblin ingestion job . In general these need to be distributed to workers in a distributed environment .
118,857
public synchronized void put ( JobSpec jobSpec ) { Preconditions . checkState ( state ( ) == State . RUNNING , String . format ( "%s is not running." , this . getClass ( ) . getName ( ) ) ) ; Preconditions . checkNotNull ( jobSpec ) ; try { long startTime = System . currentTimeMillis ( ) ; Path jobSpecPath = getPathFor...
Allow user to programmatically add a new JobSpec . The method will materialized the jobSpec into real file .
118,858
public synchronized void remove ( URI jobURI ) { Preconditions . checkState ( state ( ) == State . RUNNING , String . format ( "%s is not running." , this . getClass ( ) . getName ( ) ) ) ; try { long startTime = System . currentTimeMillis ( ) ; JobSpec jobSpec = getJobSpec ( jobURI ) ; Path jobSpecPath = getPathForURI...
Allow user to programmatically delete a new JobSpec . This method is designed to be reentrant .
118,859
protected Metric serializeValue ( String name , Number value , String ... path ) { return new Metric ( MetricRegistry . name ( name , path ) , value . doubleValue ( ) ) ; }
Converts a single key - value pair into a metric .
118,860
public Schema convertSchema ( SI inputSchema , WorkUnitState workUnit ) throws SchemaConversionException { Preconditions . checkArgument ( workUnit . contains ( ConfigurationKeys . CONVERTER_AVRO_SCHEMA_KEY ) ) ; this . schema = new Schema . Parser ( ) . parse ( workUnit . getProp ( ConfigurationKeys . CONVERTER_AVRO_S...
Ignore input schema and parse in Avro schema from config
118,861
public static boolean isAncestorOrSame ( URI descendant , URI ancestor ) { Preconditions . checkNotNull ( descendant , "input can not be null" ) ; Preconditions . checkNotNull ( ancestor , "input can not be null" ) ; if ( ! stringSame ( descendant . getScheme ( ) , ancestor . getScheme ( ) ) ) { return false ; } if ( !...
Utility method to check whether one URI is the ancestor of the other
118,862
public synchronized MD5Digest register ( String name , Schema schema ) throws IOException , SchemaRegistryException { MD5Digest md5Digest = generateId ( schema ) ; if ( ! _schemaHashMap . containsKey ( md5Digest ) ) { _schemaHashMap . put ( md5Digest , schema ) ; _topicSchemaMap . put ( name , schema ) ; } return md5Di...
Register this schema under the provided name
118,863
public Schema getById ( MD5Digest id ) throws IOException , SchemaRegistryException { if ( _schemaHashMap . containsKey ( id ) ) { return _schemaHashMap . get ( id ) ; } else { throw new SchemaRegistryException ( "Could not find schema with id : " + id . asString ( ) ) ; } }
Get a schema given an id
118,864
public long calculateRecordCount ( Collection < Path > paths ) throws IOException { long sum = 0 ; for ( Path path : paths ) { sum += inputRecordCountProvider . getRecordCount ( DatasetHelper . getApplicableFilePaths ( this . fs , path , Lists . newArrayList ( AVRO ) ) ) ; } return sum ; }
Calculate record count at given paths
118,865
public void saveState ( Path dir , State state ) throws IOException { saveState ( this . fs , dir , state ) ; }
Save compaction state file
118,866
public synchronized boolean offer ( Runnable runnable ) { int allWorkingThreads = this . executor . getActiveCount ( ) + super . size ( ) ; return allWorkingThreads < this . executor . getPoolSize ( ) && super . offer ( runnable ) ; }
Inserts the specified element at the tail of this queue if there is at least one available thread to run the current task . If all pool threads are actively busy it rejects the offer .
118,867
public FlowConfig getFlowConfig ( FlowId flowId ) throws FlowConfigLoggedException { log . info ( "[GAAS-REST] Get called with flowGroup {} flowName {}" , flowId . getFlowGroup ( ) , flowId . getFlowName ( ) ) ; try { URI flowUri = FlowUriUtils . createFlowSpecUri ( flowId ) ; FlowSpec spec = ( FlowSpec ) flowCatalog ....
Get flow config
118,868
public CreateResponse createFlowConfig ( FlowConfig flowConfig , boolean triggerListener ) throws FlowConfigLoggedException { log . info ( "[GAAS-REST] Create called with flowGroup " + flowConfig . getId ( ) . getFlowGroup ( ) + " flowName " + flowConfig . getId ( ) . getFlowName ( ) ) ; if ( flowConfig . hasExplain ( ...
Add flowConfig locally and trigger all listeners iff
118,869
public UpdateResponse updateFlowConfig ( FlowId flowId , FlowConfig flowConfig , boolean triggerListener ) { log . info ( "[GAAS-REST] Update called with flowGroup {} flowName {}" , flowId . getFlowGroup ( ) , flowId . getFlowName ( ) ) ; if ( ! flowId . getFlowGroup ( ) . equals ( flowConfig . getId ( ) . getFlowGroup...
Update flowConfig locally and trigger all listeners iff
118,870
public UpdateResponse updateFlowConfig ( FlowId flowId , FlowConfig flowConfig ) throws FlowConfigLoggedException { return updateFlowConfig ( flowId , flowConfig , true ) ; }
Update flowConfig locally and trigger all listeners
118,871
public UpdateResponse deleteFlowConfig ( FlowId flowId , Properties header , boolean triggerListener ) throws FlowConfigLoggedException { log . info ( "[GAAS-REST] Delete called with flowGroup {} flowName {}" , flowId . getFlowGroup ( ) , flowId . getFlowName ( ) ) ; URI flowUri = null ; try { flowUri = FlowUriUtils . ...
Delete flowConfig locally and trigger all listeners iff
118,872
public UpdateResponse deleteFlowConfig ( FlowId flowId , Properties header ) throws FlowConfigLoggedException { return deleteFlowConfig ( flowId , header , true ) ; }
Delete flowConfig locally and trigger all listeners
118,873
protected void createWorkUnits ( SourceState state ) throws IOException { createWorkunitsFromPreviousState ( state ) ; if ( this . datasets . isEmpty ( ) ) { return ; } for ( HivePartitionDataset dataset : this . datasets ) { Optional < String > owner = dataset . getOwner ( ) ; if ( workUnitsExceeded ( ) ) { log . info...
This method creates the list of all work units needed for the current execution . Fresh work units are created for each partition starting from watermark and failed work units from the previous run will be added to the list .
118,874
protected List < HivePartitionDataset > sortHiveDatasets ( List < HivePartitionDataset > datasets ) { Collections . sort ( datasets , new Comparator < HivePartitionDataset > ( ) { public int compare ( HivePartitionDataset o1 , HivePartitionDataset o2 ) { return o1 . datasetURN ( ) . compareTo ( o2 . datasetURN ( ) ) ; ...
Sort all HiveDatasets on the basis of complete name ie dbName . tableName
118,875
protected void createWorkunitsFromPreviousState ( SourceState state ) { if ( this . lowWatermark . equalsIgnoreCase ( ComplianceConfigurationKeys . NO_PREVIOUS_WATERMARK ) ) { return ; } if ( Iterables . isEmpty ( state . getPreviousWorkUnitStates ( ) ) ) { return ; } for ( WorkUnitState workUnitState : state . getPrev...
Add failed work units in a workUnitMap with partition name as Key . New work units are created using required configuration from the old work unit .
118,876
protected void setLowWatermark ( SourceState state ) { this . lowWatermark = getWatermarkFromPreviousWorkUnits ( state , ComplianceConfigurationKeys . HIVE_PURGER_WATERMARK ) ; log . info ( "Setting low watermark for the job: " + this . lowWatermark ) ; }
Sets the local watermark which is a class variable . Local watermark is a complete partition name which act as the starting point for the creation of fresh work units .
118,877
protected void submitCycleCompletionEvent ( ) { if ( ! this . lowWatermark . equalsIgnoreCase ( ComplianceConfigurationKeys . NO_PREVIOUS_WATERMARK ) ) { return ; } if ( this . executionCount > 1 ) { Map < String , String > metadata = new HashMap < > ( ) ; metadata . put ( ComplianceConfigurationKeys . TOTAL_EXECUTIONS...
If low watermark is at the reset point then either cycle is completed or starting for the first time If executionCount is greater than 1 then cycle is completed If cycle is completed executionCount will be reset and cycle completion event will be submitted
118,878
protected void setJobWatermark ( SourceState state , String watermark ) { state . setProp ( ComplianceConfigurationKeys . HIVE_PURGER_WATERMARK , watermark ) ; log . info ( "Setting job watermark for the job: " + watermark ) ; }
Sets Job Watermark in the SourceState which will be copied to all WorkUnitStates . Job Watermark is a complete partition name . During next run of this job fresh work units will be created starting from this partition .
118,879
protected static String getWatermarkFromPreviousWorkUnits ( SourceState state , String watermark ) { if ( state . getPreviousWorkUnitStates ( ) . isEmpty ( ) ) { return ComplianceConfigurationKeys . NO_PREVIOUS_WATERMARK ; } return state . getPreviousWorkUnitStates ( ) . get ( 0 ) . getProp ( watermark , ComplianceConf...
Fetches the value of a watermark given its key from the previous run .
118,880
public static String resolveUriPrefix ( Config config , SharedRestClientKey key ) throws URISyntaxException , NotConfiguredException { List < String > connectionPrefixes = parseConnectionPrefixes ( config , key ) ; Preconditions . checkArgument ( connectionPrefixes . size ( ) > 0 , "No uris found for service " + key . ...
Get a uri prefix from the input configuration .
118,881
public static List < String > parseConnectionPrefixes ( Config config , SharedRestClientKey key ) throws URISyntaxException , NotConfiguredException { if ( key instanceof UriRestClientKey ) { return Lists . newArrayList ( ( ( UriRestClientKey ) key ) . getUri ( ) ) ; } if ( ! config . hasPath ( SERVER_URI_KEY ) ) { thr...
Parse the list of available input prefixes from the input configuration .
118,882
public static String resolveUriPrefix ( URI serverURI ) throws URISyntaxException { if ( RESTLI_SCHEMES . contains ( serverURI . getScheme ( ) ) ) { return new URI ( serverURI . getScheme ( ) , serverURI . getAuthority ( ) , null , null , null ) . toString ( ) + "/" ; } throw new RuntimeException ( "Unrecognized scheme...
Convert the input URI into a correctly formatted uri prefix . In the future may also resolve d2 uris .
118,883
public void addAll ( GlobalMetadata other ) { throwIfImmutable ( ) ; datasetLevel . putAll ( other . datasetLevel ) ; for ( Map . Entry < String , Map < String , Object > > e : other . fileLevel . entrySet ( ) ) { Map < String , Object > val = new ConcurrentHashMap < > ( ) ; val . putAll ( e . getValue ( ) ) ; fileLeve...
Merge another GlobalMetadata object into this one . All keys from other will be placed into this object replacing any already existing keys .
118,884
public byte [ ] toJsonUtf8 ( ) { try { ByteArrayOutputStream bOs = new ByteArrayOutputStream ( 512 ) ; try ( JsonGenerator generator = jsonFactory . createJsonGenerator ( bOs , JsonEncoding . UTF8 ) . setCodec ( objectMapper ) ) { toJsonUtf8 ( generator ) ; } return bOs . toByteArray ( ) ; } catch ( IOException e ) { t...
Serialize as a UTF8 encoded JSON string .
118,885
protected void bodyToJsonUtf8 ( JsonGenerator generator ) throws IOException { generator . writeObjectField ( "dataset" , datasetLevel ) ; generator . writeObjectFieldStart ( "file" ) ; for ( Map . Entry < String , Map < String , Object > > entry : fileLevel . entrySet ( ) ) { generator . writeObjectField ( entry . get...
Write this object out to an existing JSON stream
118,886
public void setDatasetMetadata ( String key , Object val ) { throwIfImmutable ( ) ; datasetLevel . put ( key , val ) ; cachedId = null ; }
Set an arbitrary dataset - level metadata key
118,887
public synchronized void addTransferEncoding ( String encoding ) { throwIfImmutable ( ) ; List < String > encodings = getTransferEncoding ( ) ; if ( encodings == null ) { encodings = new ArrayList < > ( ) ; } encodings . add ( encoding ) ; setDatasetMetadata ( TRANSFER_ENCODING_KEY , encodings ) ; }
Convenience method to add a new transfer - encoding to a dataset
118,888
public Object getFileMetadata ( String file , String key ) { Map < String , Object > fileKeys = fileLevel . get ( file ) ; if ( fileKeys == null ) { return null ; } return fileKeys . get ( key ) ; }
Get an arbitrary file - level metadata key
118,889
public void setFileMetadata ( String file , String key , Object val ) { throwIfImmutable ( ) ; Map < String , Object > fileKeys = fileLevel . get ( file ) ; if ( fileKeys == null ) { fileKeys = new ConcurrentHashMap < > ( ) ; fileLevel . put ( file , fileKeys ) ; } fileKeys . put ( key , val ) ; cachedId = null ; }
Set an arbitrary file - level metadata key
118,890
public void awaitNextRetry ( ) throws InterruptedException , NoMoreRetriesException { this . retryNumber ++ ; if ( this . retryNumber > this . maxRetries ) { throw new NoMoreRetriesException ( "Reached maximum number of retries: " + this . maxRetries ) ; } else if ( this . totalWait > this . maxWait ) { throw new NoMor...
Block until next retry can be executed .
118,891
@ Builder ( builderMethodName = "awaitCondition" , buildMethodName = "await" ) private static boolean evaluateConditionUntilTrue ( Callable < Boolean > callable , Double alpha , Integer maxRetries , Long maxWait , Long maxDelay , Long initialDelay ) throws ExecutionException , InterruptedException { ExponentialBackoff ...
Evaluate a condition until true with exponential backoff .
118,892
public static boolean isKeySchemaValid ( Schema keySchema , Schema topicSchema ) { return SchemaCompatibility . checkReaderWriterCompatibility ( keySchema , topicSchema ) . getType ( ) . equals ( SchemaCompatibilityType . COMPATIBLE ) ; }
keySchema is valid if a record with newestSchema can be converted to a record with keySchema .
118,893
public void markRecord ( BufferedRecord < D > record , int bytesWritten ) { synchronized ( this ) { thunks . add ( new Thunk < > ( record , bytesWritten ) ) ; byteSize += bytesWritten ; } }
Mark the record associated with this request
118,894
private void interruptGracefully ( ) throws IOException { LOG . info ( "Attempting graceful interruption of job " + this . jobContext . getJobId ( ) ) ; this . fs . createNewFile ( this . interruptPath ) ; long waitTimeStart = System . currentTimeMillis ( ) ; while ( ! this . job . isComplete ( ) && System . currentTim...
Attempt a gracious interruption of the running job
118,895
private void addDependencies ( Configuration conf ) throws IOException { TimingEvent distributedCacheSetupTimer = this . eventSubmitter . getTimingEvent ( TimingEvent . RunJobTimings . MR_DISTRIBUTED_CACHE_SETUP ) ; Path jarFileDir = this . jarsDir ; if ( this . jobProps . containsKey ( ConfigurationKeys . FRAMEWORK_JA...
Add dependent jars and files .
118,896
@ SuppressWarnings ( "deprecation" ) private void addJars ( Path jarFileDir , String jarFileList , Configuration conf ) throws IOException { LocalFileSystem lfs = FileSystem . getLocal ( conf ) ; for ( String jarFile : SPLITTER . split ( jarFileList ) ) { Path srcJarFile = new Path ( jarFile ) ; FileStatus [ ] fileStat...
Add framework or job - specific jars to the classpath through DistributedCache so the mappers can use them .
118,897
@ SuppressWarnings ( "deprecation" ) private void addLocalFiles ( Path jobFileDir , String jobFileList , Configuration conf ) throws IOException { DistributedCache . createSymlink ( conf ) ; for ( String jobFile : SPLITTER . split ( jobFileList ) ) { Path srcJobFile = new Path ( jobFile ) ; Path destJobFile = new Path ...
Add local non - jar files the job depends on to DistributedCache .
118,898
@ SuppressWarnings ( "deprecation" ) private void addHDFSFiles ( String jobFileList , Configuration conf ) { DistributedCache . createSymlink ( conf ) ; jobFileList = PasswordManager . getInstance ( this . jobProps ) . readPassword ( jobFileList ) ; for ( String jobFile : SPLITTER . split ( jobFileList ) ) { Path srcJo...
Add non - jar files already on HDFS that the job depends on to DistributedCache .
118,899
private void prepareJobInput ( List < WorkUnit > workUnits ) throws IOException { Closer closer = Closer . create ( ) ; try { ParallelRunner parallelRunner = closer . register ( new ParallelRunner ( this . parallelRunnerThreads , this . fs ) ) ; int multiTaskIdSequence = 0 ; for ( WorkUnit workUnit : workUnits ) { Stri...
Prepare the job input .