idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
22,000 | public void authorize ( ) { if ( this . isSecurityEnabled ) { try { login ( this . keytabPrincipal , this . keytabPath ) ; } catch ( final IOException e ) { log . error ( e ) ; throw new AzkabanException ( String . format ( "Error: Unable to authorize to Hadoop. Principal: %s Keytab: %s" , this . keytabPrincipal , this... | API to authorize HDFS access . This logins in the configured user via the keytab . If the user is already logged in then it renews the TGT . |
22,001 | public static int validate ( final String jobName , final Props serverProps , final Props jobProps , final Collection < String > errors ) { final int maxNumCallback = serverProps . getInt ( JobCallbackConstants . MAX_CALLBACK_COUNT_PROPERTY_KEY , JobCallbackConstants . DEFAULT_MAX_CALLBACK_COUNT ) ; final int maxPostBo... | Make sure all the job callback related properties are valid |
22,002 | static String expandHiveAuxJarsPath ( final String original ) throws IOException { if ( original == null || original . endsWith ( ".jar" ) ) { return original ; } final File [ ] files = new File ( original ) . listFiles ( ) ; if ( files == null || files . length == 0 ) { return original ; } return filesToURIString ( fi... | Normally hive . aux . jars . path is expanded from just being a path to the full list of files in the directory by the hive shell script . Since we normally won t be running from the script it s up to us to do that work here . We use a heuristic that if there is no occurrence of . jar in the original it needs expansion... |
22,003 | public static void validateAllOrNone ( Props props , String ... keys ) { Objects . requireNonNull ( keys ) ; boolean allExist = true ; boolean someExist = false ; for ( String key : keys ) { Object val = props . get ( key ) ; allExist &= val != null ; someExist |= val != null ; } if ( someExist && ! allExist ) { throw ... | Validates if all of the keys exist of none of them exist |
22,004 | public static void validateAllNotEmpty ( Props props , String ... keys ) { for ( String key : keys ) { props . getString ( key ) ; } } | Validates all keys present in props |
22,005 | private static Props copyNext ( final Props source ) { Props priorNodeCopy = null ; if ( source . getParent ( ) != null ) { priorNodeCopy = copyNext ( source . getParent ( ) ) ; } final Props dest = new Props ( priorNodeCopy ) ; for ( final String key : source . localKeySet ( ) ) { dest . put ( key , source . get ( key... | Recursive Clone function of Props |
22,006 | public boolean containsKey ( final Object k ) { return this . _current . containsKey ( k ) || ( this . _parent != null && this . _parent . containsKey ( k ) ) ; } | Check key in current Props then search in parent |
22,007 | public boolean containsValue ( final Object value ) { return this . _current . containsValue ( value ) || ( this . _parent != null && this . _parent . containsValue ( value ) ) ; } | Check value in current Props then search in parent |
22,008 | public String get ( final Object key ) { if ( this . _current . containsKey ( key ) ) { return this . _current . get ( key ) ; } else if ( this . _parent != null ) { return this . _parent . get ( key ) ; } else { return null ; } } | Return value if available in current Props otherwise return from parent |
22,009 | public String put ( final String key , final Long value ) { return this . _current . put ( key , value . toString ( ) ) ; } | Put Long . Stores as String . |
22,010 | public String put ( final String key , final Double value ) { return this . _current . put ( key , value . toString ( ) ) ; } | Put Double . Stores as String . |
22,011 | public void putAll ( final Props p ) { if ( p == null ) { return ; } for ( final String key : p . getKeySet ( ) ) { this . put ( key , p . get ( key ) ) ; } } | Put all properties in the props into the current props . Will handle null p . |
22,012 | public void putLocal ( final Props p ) { for ( final String key : p . localKeySet ( ) ) { this . put ( key , p . get ( key ) ) ; } } | Puts only the local props from p into the current properties |
22,013 | public Class < ? > getClass ( final String key ) { try { if ( containsKey ( key ) ) { return Class . forName ( get ( key ) ) ; } else { throw new UndefinedPropertyException ( "Missing required property '" + key + "'" ) ; } } catch ( final ClassNotFoundException e ) { throw new IllegalArgumentException ( e ) ; } } | Attempts to return the Class that corresponds to the Props value . If the class doesn t exit an IllegalArgumentException will be thrown . |
22,014 | public Class < ? > getClass ( final String key , final Class < ? > defaultClass ) { if ( containsKey ( key ) ) { return getClass ( key ) ; } else { return defaultClass ; } } | Gets the class from the Props . If it doesn t exist it will return the defaultClass |
22,015 | public String getString ( final String key ) { if ( containsKey ( key ) ) { return get ( key ) ; } else { throw new UndefinedPropertyException ( "Missing required property '" + key + "'" ) ; } } | Gets the string from the Props . If it doesn t exist throw and UndefinedPropertiesException |
22,016 | public List < String > getStringList ( final String key , final String sep ) { final String val = get ( key ) ; if ( val == null || val . trim ( ) . length ( ) == 0 ) { return Collections . emptyList ( ) ; } if ( containsKey ( key ) ) { return Arrays . asList ( val . split ( sep ) ) ; } else { throw new UndefinedProper... | Returns a list of strings with the sep as the separator of the value |
22,017 | public List < String > getStringList ( final String key , final List < String > defaultValue ) { if ( containsKey ( key ) ) { return getStringList ( key ) ; } else { return defaultValue ; } } | Returns a list of strings with the comma as the separator of the value . If the value is null it ll return the defaultValue . |
22,018 | public long getLong ( final String name , final long defaultValue ) { if ( containsKey ( name ) ) { return Long . parseLong ( get ( name ) ) ; } else { return defaultValue ; } } | Returns the long representation of the value . If the value is null then the default value is returned . If the value isn t a long then a parse exception will be thrown . |
22,019 | public long getLong ( final String name ) { if ( containsKey ( name ) ) { return Long . parseLong ( get ( name ) ) ; } else { throw new UndefinedPropertyException ( "Missing required property '" + name + "'" ) ; } } | Returns the long representation of the value . If the value is null then a UndefinedPropertyException will be thrown . If the value isn t a long then a parse exception will be thrown . |
22,020 | public URI getUri ( final String name ) { if ( containsKey ( name ) ) { try { return new URI ( get ( name ) ) ; } catch ( final URISyntaxException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } } else { throw new UndefinedPropertyException ( "Missing required property '" + name + "'" ) ; } } | Returns the uri representation of the value . If the value is null then the default value is returned . If the value isn t a uri then a IllegalArgumentException will be thrown . |
22,021 | public URI getUri ( final String name , final URI defaultValue ) { if ( containsKey ( name ) ) { return getUri ( name ) ; } else { return defaultValue ; } } | Returns the double representation of the value . If the value is null then the default value is returned . If the value isn t a uri then a IllegalArgumentException will be thrown . |
22,022 | public URI getUri ( final String name , final String defaultValue ) { try { return getUri ( name , new URI ( defaultValue ) ) ; } catch ( final URISyntaxException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } } | Convert a URI - formatted string value to URI object |
22,023 | public Properties toAllProperties ( ) { Properties allProp = new Properties ( ) ; allProp . putAll ( toProperties ( ) ) ; if ( _parent != null ) { allProp . putAll ( _parent . toProperties ( ) ) ; } return allProp ; } | Returns a java . util . Properties file populated with both current and parent properties . |
22,024 | public Map < String , String > getFlattened ( ) { final TreeMap < String , String > returnVal = new TreeMap < > ( ) ; returnVal . putAll ( getMapByPrefix ( "" ) ) ; return returnVal ; } | Returns a new constructed map of all the flattened properties the item in the returned map is sorted alphabetically by the key value . |
22,025 | public Map < String , String > getMapByPrefix ( final String prefix ) { final Map < String , String > values = ( this . _parent == null ) ? new HashMap < > ( ) : this . _parent . getMapByPrefix ( prefix ) ; if ( prefix == null ) { return values ; } for ( final String key : this . localKeySet ( ) ) { if ( key != null &&... | Get a new de - duplicated map of all the flattened properties by given prefix . The prefix will be removed in the return map s keySet . |
22,026 | public Set < String > getKeySet ( ) { final HashSet < String > keySet = new HashSet < > ( ) ; keySet . addAll ( localKeySet ( ) ) ; if ( this . _parent != null ) { keySet . addAll ( this . _parent . getKeySet ( ) ) ; } return keySet ; } | Returns a set of all keys including the parents |
22,027 | public void logProperties ( final Logger logger , final String comment ) { logger . info ( comment ) ; for ( final String key : getKeySet ( ) ) { logger . info ( " key=" + key + " value=" + get ( key ) ) ; } } | Logs the property in the given logger |
22,028 | protected synchronized void handleJobStatusChange ( final String jobId , final Status status ) { final BlockingStatus block = this . map . get ( jobId ) ; if ( block != null ) { block . changeStatus ( status ) ; } } | Called to fire events to the JobRunner listeners |
22,029 | public static MetricReportManager getInstance ( ) { if ( instance == null ) { synchronized ( MetricReportManager . class ) { if ( instance == null ) { logger . info ( "Instantiating MetricReportManager" ) ; instance = new MetricReportManager ( ) ; } } } return instance ; } | Get a singleton object for Metric Manager |
22,030 | public void addMetric ( final IMetric < ? > metric ) { if ( metric == null ) { throw new IllegalArgumentException ( "Cannot add a null metric" ) ; } if ( getMetricFromName ( metric . getName ( ) ) == null ) { logger . debug ( String . format ( "Adding %s metric in Metric Manager" , metric . getName ( ) ) ) ; this . met... | Add a metric to be managed by Metric Manager |
22,031 | public IMetric < ? > getMetricFromName ( final String name ) { IMetric < ? > metric = null ; if ( name != null ) { for ( final IMetric < ? > currentMetric : this . metrics ) { if ( currentMetric . getName ( ) . equals ( name ) ) { metric = currentMetric ; break ; } } } return metric ; } | Get metric object for a given metric name |
22,032 | public void disableManager ( ) { logger . info ( "Disabling Metric Manager" ) ; if ( isManagerEnabled ) { isManagerEnabled = false ; for ( final IMetricEmitter emitter : this . metricEmitters ) { try { emitter . purgeAllData ( ) ; } catch ( final MetricException ex ) { logger . error ( "Failed to purge data " , ex ) ; ... | Disable Metric Manager and ask all emitters to purge all available data . |
22,033 | public List < InMemoryHistoryNode > getMetrics ( final String metricName , final Date from , final Date to , final Boolean useStats ) throws ClassCastException { final LinkedList < InMemoryHistoryNode > selectedLists = new LinkedList < > ( ) ; if ( this . historyListMapping . containsKey ( metricName ) ) { logger . deb... | Get snapshots for a given metric at a given time |
22,034 | private void statBasedSelectMetricHistory ( final LinkedList < InMemoryHistoryNode > selectedLists ) throws ClassCastException { logger . debug ( "selecting snapshots which are far away from mean value" ) ; final DescriptiveStatistics descStats = getDescriptiveStatistics ( selectedLists ) ; final Double mean = descStat... | filter snapshots using statistically significant points only |
22,035 | private void generalSelectMetricHistory ( final LinkedList < InMemoryHistoryNode > selectedLists ) { logger . debug ( "selecting snapshots evenly from across the time interval" ) ; if ( selectedLists . size ( ) > this . numInstances ) { final double step = ( double ) selectedLists . size ( ) / this . numInstances ; lon... | filter snapshots by evenly selecting points across the interval |
22,036 | private void cleanUsingTime ( final String metricName , final Date firstAllowedDate ) { if ( this . historyListMapping . containsKey ( metricName ) && this . historyListMapping . get ( metricName ) != null ) { synchronized ( this . historyListMapping . get ( metricName ) ) { InMemoryHistoryNode firstNode = this . histo... | Remove snapshots to maintain reporting interval |
22,037 | @ SuppressWarnings ( "unchecked" ) public void updateExecutions ( ) { this . updaterStage . set ( "Starting update all flows." ) ; final Map < Optional < Executor > , List < ExecutableFlow > > exFlowMap = getFlowToExecutorMap ( ) ; final ArrayList < ExecutableFlow > finalizeFlows = new ArrayList < > ( ) ; for ( final M... | Updates running executions . |
22,038 | public synchronized List < String > getTopicList ( ) { final List < String > res = new ArrayList < > ( this . topicEventMap . keySet ( ) ) ; return res ; } | Get a list of topics . |
22,039 | public synchronized Set < String > regexInTopic ( final String topic , final String payload ) { final Set < String > res = new HashSet < > ( ) ; final Map < String , List < KafkaDependencyInstanceContext > > eventMap = this . topicEventMap . get ( topic ) ; if ( eventMap == null ) { return Collections . emptySet ( ) ; ... | Return a set of pattern that matches with the payload . |
22,040 | public synchronized List < KafkaDependencyInstanceContext > getDepsByTopicAndEvent ( final String topic , final String regex ) { final Map < String , List < KafkaDependencyInstanceContext > > regexMap = this . topicEventMap . get ( topic ) ; if ( regexMap != null ) { return regexMap . get ( regex ) ; } return Collectio... | Returns dependencies with topic and dependency s event regular expression match |
22,041 | public static Event create ( final Object runner , final EventType type , final EventData eventData ) throws NullPointerException { Preconditions . checkNotNull ( eventData , "EventData was null" ) ; return new Event ( runner , type , eventData ) ; } | Creates a new event . |
22,042 | public static String getRealClientIpAddr ( final Map < String , String > httpHeaders , final String remoteAddr ) { String clientIp = httpHeaders . getOrDefault ( X_FORWARDED_FOR_HEADER , null ) ; if ( clientIp == null ) { clientIp = remoteAddr ; } else { final String [ ] ips = clientIp . split ( "," ) ; clientIp = ips ... | Gets the actual client IP address inspecting the X - Forwarded - For HTTP header or using the provided remote IP address from the low level TCP connection from the client . |
22,043 | public static void setPropsInYamlFile ( final String path , final File flowFile , final Props prop ) { final DumperOptions options = new DumperOptions ( ) ; options . setDefaultFlowStyle ( FlowStyle . BLOCK ) ; final NodeBean nodeBean = FlowLoaderUtils . setPropsInNodeBean ( path , flowFile , prop ) ; try ( final Buffe... | Sets props in flow yaml file . |
22,044 | public static NodeBean setPropsInNodeBean ( final String path , final File flowFile , final Props prop ) { final NodeBeanLoader loader = new NodeBeanLoader ( ) ; try { final NodeBean nodeBean = loader . load ( flowFile ) ; final String [ ] pathList = path . split ( Constants . PATH_DELIMITER ) ; if ( overridePropsInNod... | Sets props in node bean . |
22,045 | private static boolean overridePropsInNodeBean ( final NodeBean nodeBean , final String [ ] pathList , final int idx , final Props prop ) { if ( idx < pathList . length && nodeBean . getName ( ) . equals ( pathList [ idx ] ) ) { if ( idx == pathList . length - 1 ) { if ( prop . containsKey ( Constants . NODE_TYPE ) ) {... | Helper method to recursively find the node to override props . |
22,046 | public static Props getPropsFromYamlFile ( final String path , final File flowFile ) { final List < Props > propsList = new ArrayList < > ( ) ; final NodeBeanLoader loader = new NodeBeanLoader ( ) ; try { final NodeBean nodeBean = loader . load ( flowFile ) ; final String [ ] pathList = path . split ( Constants . PATH_... | Gets flow or job props from flow yaml file . |
22,047 | private static boolean findPropsFromNodeBean ( final NodeBean nodeBean , final String [ ] pathList , final int idx , final List < Props > propsList ) { if ( idx < pathList . length && nodeBean . getName ( ) . equals ( pathList [ idx ] ) ) { if ( idx == pathList . length - 1 ) { propsList . add ( nodeBean . getProps ( )... | Helper method to recursively find props from node bean . |
22,048 | public static void addEmailPropsToFlow ( final Flow flow , final Props prop ) { final List < String > successEmailList = prop . getStringList ( CommonJobProperties . SUCCESS_EMAILS , Collections . EMPTY_LIST ) ; final Set < String > successEmail = new HashSet < > ( ) ; for ( final String email : successEmailList ) { su... | Adds email properties to a flow . |
22,049 | public static ValidationReport generateFlowLoaderReport ( final Set < String > errors ) { final ValidationReport report = new ValidationReport ( ) ; report . addErrorMsgs ( errors ) ; return report ; } | Generate flow loader report validation report . |
22,050 | public static void checkJobProperties ( final int projectId , final Props props , final Map < String , Props > jobPropsMap , final Set < String > errors ) { if ( ProjectWhitelist . isProjectWhitelisted ( projectId , ProjectWhitelist . WhitelistType . MemoryCheck ) ) { return ; } final MemConfValue maxXms = MemConfValue... | Check job properties . |
22,051 | public static void cleanUpDir ( final File dir ) { try { if ( dir != null && dir . exists ( ) ) { FileUtils . deleteDirectory ( dir ) ; } } catch ( final IOException e ) { logger . error ( "Failed to delete the directory" , e ) ; dir . deleteOnExit ( ) ; } } | Clean up the directory . |
22,052 | public Project getProject ( final String name ) { Project fetchedProject = this . projectsByName . get ( name ) ; if ( fetchedProject == null ) { try { fetchedProject = this . projectLoader . fetchProjectByName ( name ) ; if ( fetchedProject != null ) { logger . info ( "Project " + name + " not found in cache, fetched ... | fetch active project by project name . Queries the cache first then db if not found |
22,053 | public Project getProject ( final int id ) { Project fetchedProject = this . projectsById . get ( id ) ; if ( fetchedProject == null ) { try { fetchedProject = this . projectLoader . fetchProjectById ( id ) ; } catch ( final ProjectManagerException e ) { logger . error ( "Could not load project from store." , e ) ; } }... | fetch active project from cache and inactive projects from db by project_id |
22,054 | public synchronized Project purgeProject ( final Project project , final User deleter ) throws ProjectManagerException { this . projectLoader . cleanOlderProjectVersion ( project . getId ( ) , project . getVersion ( ) + 1 , Collections . emptyList ( ) ) ; this . projectLoader . postEvent ( project , EventType . PURGE ,... | Permanently delete all project files and properties data for all versions of a project and log event in project_events table |
22,055 | public static String join ( final Collection < String > list , final String delimiter ) { final StringBuffer buffer = new StringBuffer ( ) ; for ( final String str : list ) { buffer . append ( str ) ; buffer . append ( delimiter ) ; } return buffer . toString ( ) ; } | Use this when you don t want to include Apache Common s string for plugins . |
22,056 | public static String join2 ( final Collection < String > list , final String delimiter ) { final StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; for ( final String str : list ) { if ( ! first ) { buffer . append ( delimiter ) ; } buffer . append ( str ) ; first = false ; } return buffer . toString (... | Don t bother to add delimiter for last element |
22,057 | private void handleAjaxAction ( final HttpServletRequest req , final HttpServletResponse resp , final Session session , final ProjectManager manager ) throws ServletException , IOException { final String ajaxName = getParam ( req , "ajax" ) ; final HashMap < String , Object > ret = new HashMap < > ( ) ; if ( ajaxName .... | ProjectServlet class now handles ajax requests . It returns a |
22,058 | private void handlePageRender ( final HttpServletRequest req , final HttpServletResponse resp , final Session session , final ProjectManager manager ) { final User user = session . getUser ( ) ; final Page page = newPage ( req , resp , session , "azkaban/webapp/servlet/velocity/index.vm" ) ; if ( this . lockdownCreateP... | Renders the user homepage that users see when they log in |
22,059 | public void schedule ( final Project project , final String submitUser ) throws ProjectManagerException , IOException , SchedulerException { for ( final Flow flow : project . getFlows ( ) ) { if ( flow . isEmbeddedFlow ( ) ) { continue ; } final String flowFileName = flow . getId ( ) + ".flow" ; final int latestFlowVer... | Schedule flows containing flow triggers for this project . |
22,060 | public List < ScheduledFlowTrigger > getScheduledFlowTriggerJobs ( ) { try { final Scheduler quartzScheduler = this . scheduler . getScheduler ( ) ; final List < String > groupNames = quartzScheduler . getJobGroupNames ( ) ; final List < ScheduledFlowTrigger > flowTriggerJobDetails = new ArrayList < > ( ) ; for ( final... | Retrieve the list of scheduled flow triggers from quartz database |
22,061 | public void unschedule ( final Project project ) throws SchedulerException { for ( final Flow flow : project . getFlows ( ) ) { if ( ! flow . isEmbeddedFlow ( ) ) { try { if ( this . scheduler . unscheduleJob ( FlowTriggerQuartzJob . JOB_NAME , generateGroupName ( flow ) ) ) { logger . info ( "Flow {}.{} unregistered f... | Unschedule all possible flows in a project |
22,062 | private void handleGetAllMetricName ( final int executorId , final HttpServletRequest req , final HashMap < String , Object > ret ) throws IOException { final Map < String , Object > result ; try { result = this . execManagerAdapter . callExecutorStats ( executorId , ConnectorParams . STATS_GET_ALLMETRICSNAME , ( Pair ... | Get all metrics tracked by the given executor |
22,063 | private void handleChangeConfigurationRequest ( final int executorId , final String actionName , final HttpServletRequest req , final HashMap < String , Object > ret ) throws ServletException , IOException { try { final Map < String , Object > result = this . execManagerAdapter . callExecutorStats ( executorId , action... | Generic method to facilitate actionName action using Azkaban exec server |
22,064 | private Pair < String , String > [ ] getAllParams ( final HttpServletRequest req ) { final List < Pair < String , String > > allParams = new LinkedList < > ( ) ; final Iterator it = req . getParameterMap ( ) . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { final Map . Entry pairs = ( Map . Entry ) it . next... | Parse all Http request params |
22,065 | public Node createNode ( final String name , final NodeProcessor nodeProcessor ) { checkIsBuilt ( ) ; if ( this . nameToNodeMap . get ( name ) != null ) { throw new DagException ( String . format ( "Node names in %s need to be unique. The name " + "(%s) already exists." , this , name ) ) ; } final Node node = new Node ... | Creates a new node and adds it to the DagBuilder . |
22,066 | private void checkCircularDependencies ( ) { class CircularDependencyChecker { private final Set < Node > toVisit = new HashSet < > ( DagBuilder . this . nameToNodeMap . values ( ) ) ; private final Set < Node > finished = new HashSet < > ( ) ; private final Set < Node > ongoing = new HashSet < > ( ) ; private final Li... | Checks if the builder contains nodes that form a circular dependency ring . |
22,067 | public static void finalizeFlow ( final ExecutorLoader executorLoader , final AlerterHolder alerterHolder , final ExecutableFlow flow , final String reason , final Throwable originalError ) { boolean alertUser = true ; try { final ExecutableFlow dsFlow ; if ( isFinished ( flow ) ) { dsFlow = flow ; } else { dsFlow = ex... | If the current status of the execution is not one of the finished statuses mark the execution as failed in the DB . |
22,068 | public static void alertUserOnFlowFinished ( final ExecutableFlow flow , final AlerterHolder alerterHolder , final String [ ] extraReasons ) { final ExecutionOptions options = flow . getExecutionOptions ( ) ; final Alerter mailAlerter = alerterHolder . get ( "email" ) ; if ( flow . getStatus ( ) != Status . SUCCEEDED )... | When a flow is finished alert the user as is configured in the execution options . |
22,069 | public static void alertUserOnFirstError ( final ExecutableFlow flow , final AlerterHolder alerterHolder ) { final ExecutionOptions options = flow . getExecutionOptions ( ) ; if ( options . getNotifyOnFirstFailure ( ) ) { logger . info ( "Alert on first error of execution " + flow . getExecutionId ( ) ) ; final Alerter... | Alert the user when the flow has encountered the first error . |
22,070 | public static String [ ] getFinalizeFlowReasons ( final String reason , final Throwable originalError ) { final List < String > reasons = new LinkedList < > ( ) ; reasons . add ( reason ) ; if ( originalError != null ) { reasons . add ( ExceptionUtils . getStackTrace ( originalError ) ) ; } return reasons . toArray ( n... | Get the reasons to finalize the flow . |
22,071 | public static void failEverything ( final ExecutableFlow exFlow ) { final long time = System . currentTimeMillis ( ) ; for ( final ExecutableNode node : exFlow . getExecutableNodes ( ) ) { switch ( node . getStatus ( ) ) { case SUCCEEDED : case FAILED : case KILLED : case SKIPPED : case DISABLED : continue ; case READY... | Set the flow status to failed and fail every node inside the flow . |
22,072 | public static boolean isFinished ( final ExecutableFlow flow ) { switch ( flow . getStatus ( ) ) { case SUCCEEDED : case FAILED : case KILLED : return true ; default : return false ; } } | Check if the flow status is finished . |
22,073 | public static void main ( final String [ ] args ) throws Exception { StdOutErrRedirect . redirectOutAndErrToLog ( ) ; logger . info ( "Starting Jetty Azkaban Executor..." ) ; if ( System . getSecurityManager ( ) == null ) { Policy . setPolicy ( new Policy ( ) { public boolean implies ( final ProtectionDomain domain , f... | Azkaban using Jetty |
22,074 | private void configureMetricReports ( ) throws MetricException { final Props props = getAzkabanProps ( ) ; if ( props != null && props . getBoolean ( "executor.metric.reports" , false ) ) { logger . info ( "Starting to configure Metric Reports" ) ; final MetricReportManager metricManager = MetricReportManager . getInst... | Configure Metric Reporting as per azkaban . properties settings |
22,075 | private void loadCustomJMXAttributeProcessor ( final Props props ) { final String jmxAttributeEmitter = props . get ( CUSTOM_JMX_ATTRIBUTE_PROCESSOR_PROPERTY ) ; if ( jmxAttributeEmitter != null ) { try { logger . info ( "jmxAttributeEmitter: " + jmxAttributeEmitter ) ; final Constructor < Props > [ ] constructors = ( ... | Load a custom class which is provided by a configuration CUSTOM_JMX_ATTRIBUTE_PROCESSOR_PROPERTY . |
22,076 | public String getHost ( ) { if ( this . props . containsKey ( ConfigurationKeys . AZKABAN_SERVER_HOST_NAME ) ) { final String hostName = this . props . getString ( Constants . ConfigurationKeys . AZKABAN_SERVER_HOST_NAME ) ; if ( ! StringUtils . isEmpty ( hostName ) ) { return hostName ; } } String host = "unkownHost" ... | Get the hostname |
22,077 | public int getPort ( ) { final Connector [ ] connectors = this . server . getConnectors ( ) ; checkState ( connectors . length >= 1 , "Server must have at least 1 connector" ) ; return connectors [ 0 ] . getLocalPort ( ) ; } | Get the current server port |
22,078 | public void run ( ) { if ( isTriggerExpired ( ) ) { logger . info ( this + " expired" ) ; return ; } final boolean isTriggerConditionMet = this . triggerCondition . isMet ( ) ; if ( isTriggerConditionMet ) { logger . info ( "Condition " + this . triggerCondition . getExpression ( ) + " met" ) ; for ( final TriggerActio... | Perform the action if trigger condition is met |
22,079 | protected void fillRemainingMemoryPercent ( final ExecutorInfo stats ) { if ( exists_Bash && exists_Cat && exists_Grep && exists_Meminfo ) { try { final ArrayList < String > output = Utils . runProcess ( "/bin/bash" , "-c" , "/bin/cat /proc/meminfo | grep -E \"^MemTotal:|^MemFree:|^Buffers:|^Cached:|^SwapCached:\"" ) ;... | fill the result set with the percent of the remaining system memory on the server . |
22,080 | protected synchronized void populateStatistics ( final boolean noCache ) { if ( noCache || System . currentTimeMillis ( ) - lastRefreshedTime > cacheTimeInMilliseconds ) { final ExecutorInfo stats = new ExecutorInfo ( ) ; fillRemainingMemoryPercent ( stats ) ; fillRemainingFlowCapacityAndLastDispatchedTime ( stats ) ; ... | call the data providers to fill the returning data container for statistics data . This function refreshes the static cached copy of data in case if necessary . |
22,081 | protected void fillRemainingFlowCapacityAndLastDispatchedTime ( final ExecutorInfo stats ) { final AzkabanExecutorServer server = AzkabanExecutorServer . getApp ( ) ; if ( server != null ) { final FlowRunnerManager runnerMgr = AzkabanExecutorServer . getApp ( ) . getFlowRunnerManager ( ) ; final int assignedFlows = run... | fill the result set with the remaining flow capacity . |
22,082 | public void init ( Props sysProps , Props jobProps , final Logger logger ) { shouldProxy = sysProps . getBoolean ( HadoopSecurityManager . ENABLE_PROXYING , false ) ; jobProps . put ( HadoopSecurityManager . ENABLE_PROXYING , Boolean . toString ( shouldProxy ) ) ; obtainTokens = sysProps . getBoolean ( HadoopSecurityMa... | Initialize the Hadoop Proxy Object |
22,083 | public void setupPropsForProxy ( Props props , Props jobProps , final Logger logger ) throws Exception { if ( isProxyEnabled ( ) ) { userToProxy = jobProps . getString ( HadoopSecurityManager . USER_TO_PROXY ) ; logger . info ( "Need to proxy. Getting tokens." ) ; tokenFile = HadoopJobUtils . getHadoopTokens ( hadoopSe... | Setup Job Properties when the proxy is enabled |
22,084 | public String getJVMArgument ( Props sysProps , Props jobProps , final Logger logger ) { String secure = "" ; if ( shouldProxy ) { logger . info ( "Setting up secure proxy info for child process" ) ; secure = " -D" + HadoopSecurityManager . USER_TO_PROXY + "=" + jobProps . getString ( HadoopSecurityManager . USER_TO_PR... | Generate JVM Proxy Secure Argument |
22,085 | public void cancelHadoopTokens ( final Logger logger ) { if ( tokenFile == null ) { return ; } try { hadoopSecurityManager . cancelTokens ( tokenFile , userToProxy , logger ) ; } catch ( HadoopSecurityManagerException e ) { logger . error ( e . getCause ( ) + e . getMessage ( ) ) ; } catch ( Exception e ) { logger . er... | Cancel Hadoop Tokens |
22,086 | public void killAllSpawnedHadoopJobs ( Props jobProps , final Logger logger ) { if ( tokenFile == null ) { return ; } final String logFilePath = jobProps . getString ( CommonJobProperties . JOB_LOG_FILE ) ; logger . info ( "Log file path is: " + logFilePath ) ; HadoopJobUtils . proxyUserKillAllSpawnedHadoopJobs ( logFi... | Kill all Spawned Hadoop Jobs |
22,087 | public static void updateProjectNotifications ( final Project project , final ProjectManager pm ) throws ProjectManagerException { final Flow flow = project . getFlows ( ) . get ( 0 ) ; final ArrayList < String > successEmails = new ArrayList < > ( ) ; final String successNotifications = ( String ) project . getMetadat... | Updates the email notifications saved in the project s flow . |
22,088 | public static Set < String > parseUniqueEmails ( final String emailList , final String splitRegex ) { final Set < String > uniqueEmails = new HashSet < > ( ) ; if ( emailList == null ) { return uniqueEmails ; } final String [ ] emails = emailList . trim ( ) . split ( splitRegex ) ; for ( final String email : emails ) {... | Given a string containing multiple emails splits it based on the given regular expression and returns a set containing the unique non - empty emails . |
22,089 | public static boolean isValidEmailAddress ( final String email ) { if ( email == null ) { return false ; } boolean result = true ; try { final InternetAddress emailAddr = new InternetAddress ( email ) ; emailAddr . validate ( ) ; } catch ( final AddressException ex ) { result = false ; } return result ; } | Returns true if the given email is valid and false otherwise . |
22,090 | public static String getEmailDomain ( final String email ) { if ( email == null || email . isEmpty ( ) ) { return null ; } final int atSignIndex = email . indexOf ( '@' ) ; if ( atSignIndex != - 1 ) { return email . substring ( atSignIndex + 1 ) ; } return null ; } | Given an email string returns the domain part if it exists and null otherwise . |
22,091 | public void finalizeFlow ( final ExecutableFlow flow , final String reason , final Throwable originalError ) { final int execId = flow . getExecutionId ( ) ; boolean alertUser = true ; this . updaterStage . set ( "finalizing flow " + execId ) ; try { final ExecutableFlow dsFlow ; if ( ExecutionControllerUtils . isFinis... | If the current status of the execution is not one of the finished statuses marks the execution as failed in the DB . Removes the execution from the running executions cache . |
22,092 | private static ArrayList < URL > getUrls ( File [ ] files ) { final ArrayList < URL > urls = new ArrayList < > ( ) ; for ( File file : files ) { try { final URL url = file . toURI ( ) . toURL ( ) ; urls . add ( url ) ; } catch ( final MalformedURLException e ) { logger . error ( "File is not convertible to URL." , e ) ... | Convert a list of files to a list of files URLs |
22,093 | public FlowLoader createFlowLoader ( final File projectDir ) throws ProjectManagerException { if ( checkForValidProjectYamlFile ( projectDir ) ) { return new DirectoryYamlFlowLoader ( this . props ) ; } else { return new DirectoryFlowLoader ( this . props ) ; } } | Creates flow loader based on project YAML file inside project directory . |
22,094 | public void loadValidators ( final Props props , final Logger log ) { this . validators = new LinkedHashMap < > ( ) ; if ( ! props . containsKey ( ValidatorConfigs . XML_FILE_PARAM ) ) { logger . warn ( "Azkaban properties file does not contain the key " + ValidatorConfigs . XML_FILE_PARAM ) ; return ; } final String x... | Instances of the validators are created here rather than in the constructors . This is because some validators might need to maintain project - specific states . By instantiating the validators here it ensures that the validator objects are project - specific rather than global . |
22,095 | public static URI buildUri ( final String host , final int port , final String path , final boolean isHttp , final Pair < String , String > ... params ) throws IOException { final URIBuilder builder = new URIBuilder ( ) ; builder . setScheme ( isHttp ? "http" : "https" ) . setHost ( host ) . setPort ( port ) ; if ( nul... | helper function to build a valid URI . |
22,096 | private static HttpEntityEnclosingRequestBase completeRequest ( final HttpEntityEnclosingRequestBase request , final List < Pair < String , String > > params ) throws UnsupportedEncodingException { if ( request != null ) { if ( null != params && ! params . isEmpty ( ) ) { final List < NameValuePair > formParams = param... | helper function to fill the request with header entries and posting body . |
22,097 | public T httpPost ( final URI uri , final List < Pair < String , String > > params ) throws IOException { if ( null == uri ) { logger . error ( " unable to perform httpPost as the passed uri is null." ) ; return null ; } final HttpPost post = new HttpPost ( uri ) ; return this . sendAndReturn ( completeRequest ( post ,... | function to perform a Post http request . |
22,098 | protected T sendAndReturn ( final HttpUriRequest request ) throws IOException { try ( CloseableHttpClient client = HttpClients . createDefault ( ) ) { return this . parseResponse ( client . execute ( request ) ) ; } } | function to dispatch the request and pass back the response . |
22,099 | private void logRequest ( final HttpServletRequest req , final Session session ) { final StringBuilder buf = new StringBuilder ( ) ; buf . append ( getRealClientIpAddr ( req ) ) . append ( " " ) ; if ( session != null && session . getUser ( ) != null ) { buf . append ( session . getUser ( ) . getUserId ( ) ) . append (... | Log out request - the format should be close to Apache access log format |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.